diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 92dbd2e57617..306aaff399a7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-databasefleetmanager;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.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index ff71d092c5bb..ae5d92de80e2 100644 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,7 @@ sdk/costmanagement sdk/customerinsights sdk/dashboard + sdk/databasefleetmanager sdk/databasewatcher sdk/databox sdk/databoxedge diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/CHANGELOG.md b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/CHANGELOG.md new file mode 100644 index 000000000000..e3e878db16f4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-15) + +- Azure Resource Manager databasefleetmanager client library for Java. This package contains Microsoft Azure SDK for databasefleetmanager Management SDK. Database Fleet Client. 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-databasefleetmanager Java SDK. diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/README.md b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/README.md new file mode 100644 index 000000000000..dc957f688fae --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager databasefleetmanager client library for Java + +Azure Resource Manager databasefleetmanager client library for Java. + +This package contains Microsoft Azure SDK for databasefleetmanager Management SDK. Database Fleet Client. 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-databasefleetmanager;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-databasefleetmanager + 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(); +DatabasefleetmanagerManager manager = DatabasefleetmanagerManager + .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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/SAMPLE.md b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/SAMPLE.md new file mode 100644 index 000000000000..845d76b6b932 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/SAMPLE.md @@ -0,0 +1,1015 @@ +# Code snippets and samples + + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByFleetspace](#firewallrules_listbyfleetspace) + +## FleetDatabases + +- [ChangeTier](#fleetdatabases_changetier) +- [CreateOrUpdate](#fleetdatabases_createorupdate) +- [Delete](#fleetdatabases_delete) +- [Get](#fleetdatabases_get) +- [ListByFleetspace](#fleetdatabases_listbyfleetspace) +- [Rename](#fleetdatabases_rename) +- [Revert](#fleetdatabases_revert) +- [Update](#fleetdatabases_update) + +## FleetTiers + +- [CreateOrUpdate](#fleettiers_createorupdate) +- [Delete](#fleettiers_delete) +- [Disable](#fleettiers_disable) +- [Get](#fleettiers_get) +- [ListByFleet](#fleettiers_listbyfleet) +- [Update](#fleettiers_update) + +## Fleets + +- [CreateOrUpdate](#fleets_createorupdate) +- [Delete](#fleets_delete) +- [GetByResourceGroup](#fleets_getbyresourcegroup) +- [List](#fleets_list) +- [ListByResourceGroup](#fleets_listbyresourcegroup) +- [Update](#fleets_update) + +## Fleetspaces + +- [CreateOrUpdate](#fleetspaces_createorupdate) +- [Delete](#fleetspaces_delete) +- [Get](#fleetspaces_get) +- [ListByFleet](#fleetspaces_listbyfleet) +- [RegisterServer](#fleetspaces_registerserver) +- [Unregister](#fleetspaces_unregister) +- [Update](#fleetspaces_update) + +## Operations + +- [List](#operations_list) +### FirewallRules_CreateOrUpdate + +```java +/** + * Samples for Fleetspaces Unregister. + */ +public final class FleetspacesUnregisterSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Unregister_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Unregister_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesUnregisterMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .unregister("rg-database-fleet-manager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_Delete + +```java +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; + +/** + * Samples for FleetDatabases ChangeTier. + */ +public final class FleetDatabasesChangeTierSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_ChangeTier_MaximumSet_Gen.json + */ + /** + * Sample code: Change Database Tier - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void changeDatabaseTierGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .changeTier("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + new DatabaseChangeTierProperties().withTargetTierName("Standard"), com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +/** + * Samples for FleetDatabases ListByFleetspace. + */ +public final class FleetDatabasesListByFleetspaceSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_ListByFleetspace_MaximumSet_Gen.json + */ + /** + * Sample code: List Databases in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void listDatabasesInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .listByFleetspace("rg-database-operations", "data-fleet-01", "prod-environment", 24L, 2L, + "tier eq 'Premium'", "sbrskcoueja", com.azure.core.util.Context.NONE); + } +} +``` + +### FirewallRules_ListByFleetspace + +```java +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; + +/** + * Samples for FleetDatabases Rename. + */ +public final class FleetDatabasesRenameSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Rename_MaximumSet_Gen.json + */ + /** + * Sample code: Rename Database in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void renameDatabaseInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .rename("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + new DatabaseRenameProperties().withNewName("new-customer-db-prod"), com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_ChangeTier + +```java +import com.azure.resourcemanager.databasefleetmanager.models.DestinationTierOverride; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ResourceType; +import java.util.Arrays; + +/** + * Samples for Fleetspaces RegisterServer. + */ +public final class FleetspacesRegisterServerSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_RegisterServer_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_RegisterServer_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesRegisterServerMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .registerServer("rg-database-fleet-manager", "production-fleet", "primary-space", + new RegisterServerProperties().withTierName("Standard") + .withSourceSubscriptionId("c76e2b32-46c7-4325-8f4f-476828a5b207") + .withSourceResourceGroupName("rg-source-database") + .withSourceServerName("source-db-server-prod") + .withDestinationTierOverrides( + Arrays.asList(new DestinationTierOverride().withResourceType(ResourceType.DATABASE) + .withTierName("bronze") + .withResourceName("source-db-prod"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_CreateOrUpdate + +```java +/** + * Samples for FirewallRules Get. + */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Get Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void getFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .getWithResponse("rg-networking-operations", "data-fleet-01", "prod-environment", + "allow-10-0-0-0-24-to-10-1-0-0-24", com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_Delete + +```java +/** + * Samples for Fleets ListByResourceGroup. + */ +public final class FleetsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_ListByResourceGroup_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsListByResourceGroupMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .listByResourceGroup("rg-database-fleet-manager", 6L, 30L, "ovlavzakdncfvvbdhqkal", + com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_Get + +```java +/** + * Samples for Fleets Delete. + */ +public final class FleetsDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets().delete("rg-database-fleet-manager", "production-fleet-01", com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_ListByFleetspace + +```java +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; + +/** + * Samples for Fleetspaces CreateOrUpdate. + */ +public final class FleetspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .define("primary-space") + .withExistingFleet("rgdatabasefleetmanager", "production-fleet") + .withProperties(new FleetspaceProperties().withCapacityMax(150000) + .withMainPrincipal(new MainPrincipal().withLogin("adminUser") + .withApplicationId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39") + .withObjectId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withTenantId("bde45d44-ec42-45b8-a5a2-c5b998c65ef6") + .withPrincipalType(PrincipalType.APPLICATION))) + .create(); + } +} +``` + +### FleetDatabases_Rename + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_Revert + +```java +/** + * Samples for Fleets List. + */ +public final class FleetsListSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_List_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets().list(com.azure.core.util.Context.NONE); + } +} +``` + +### FleetDatabases_Update + +```java +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseCreateMode; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabaseProperties; +import com.azure.resourcemanager.databasefleetmanager.models.Identity; +import com.azure.resourcemanager.databasefleetmanager.models.IdentityType; +import com.azure.resourcemanager.databasefleetmanager.models.TransparentDataEncryption; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FleetDatabases CreateOrUpdate. + */ +public final class FleetDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Database in Fleet - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateDatabaseInFleetGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .define("customer-db-prod") + .withExistingFleetspace("rg-database-operations", "data-fleet-01", "prod-environment") + .withProperties(new FleetDatabaseProperties().withCreateMode(DatabaseCreateMode.DEFAULT) + .withTierName("Premium") + .withRestoreFromTime(OffsetDateTime.parse("2024-11-06T09:16:05.048Z")) + .withSourceDatabaseName("existing-db-prod") + .withResourceTags(mapOf("project", "Customer Data")) + .withIdentity(new Identity().withIdentityType(IdentityType.NONE) + .withUserAssignedIdentities(Arrays.asList(new DatabaseIdentity().withResourceId( + "/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01") + .withPrincipalId("a2b3c4d5-6789-0123-4567-89abcdef1234") + .withClientId("a2b3c4d5-6789-0123-4567-89abcdef1234"))) + .withFederatedClientId("a2b3c4d5-6789-0123-4567-89abcdef1234")) + .withTransparentDataEncryption(new TransparentDataEncryption().withKeyUri("fakeTokenPlaceholder") + .withKeys(Arrays.asList("key1")) + .withEnableAutoRotation(true))) + .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; + } +} +``` + +### FleetTiers_CreateOrUpdate + +```java +/** + * Samples for FleetDatabases Delete. + */ +public final class FleetDatabasesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: FleetDatabases_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetDatabasesDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .delete("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} +``` + +### FleetTiers_Delete + +```java +/** + * Samples for Fleetspaces Delete. + */ +public final class FleetspacesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .delete("rgdatabasefleetmanager", "production-fleet", "primary-space", com.azure.core.util.Context.NONE); + } +} +``` + +### FleetTiers_Disable + +```java +/** + * Samples for FleetTiers ListByFleet. + */ +public final class FleetTiersListByFleetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_ListByFleet_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_ListByFleet_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersListByFleetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .listByFleet("rg-database-fleet-manager", "critical-production-fleet", 10L, 1L, "hfrg", + com.azure.core.util.Context.NONE); + } +} +``` + +### FleetTiers_Get + +```java +/** + * Samples for FirewallRules ListByFleetspace. + */ +public final class FirewallRulesListByFleetspaceSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_ListByFleetspace_MaximumSet_Gen.json + */ + /** + * Sample code: List Firewall Rules by Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void listFirewallRulesByFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .listByFleetspace("rg-networking-operations", "data-fleet-01", "prod-environment", 8L, 18L, + "thjchalxuwykrawwdgaie", com.azure.core.util.Context.NONE); + } +} +``` + +### FleetTiers_ListByFleet + +```java +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; + +/** + * Samples for FleetTiers Update. + */ +public final class FleetTiersUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + FleetTier resource = manager.fleetTiers() + .getWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetTierProperties().withServerless(false) + .withPooled(true) + .withServiceTier("GeneralPurpose") + .withFamily("Gen5") + .withCapacity(4) + .withPoolNumOfDatabasesMax(10) + .withHighAvailabilityReplicaCount(5) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(0.0D) + .withDatabaseCapacityMax(4.0D) + .withDatabaseSizeGbMax(50)) + .apply(); + } +} +``` + +### FleetTiers_Update + +```java +/** + * Samples for FleetTiers Delete. + */ +public final class FleetTiersDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .delete("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_CreateOrUpdate + +```java +/** + * Samples for FirewallRules Delete. + */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Delete Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void deleteFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .delete("rg-networking-operations", "data-fleet-01", "prod-environment", "allow-10-0-0-0-24-to-10-1-0-0-24", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_Delete + +```java +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets CreateOrUpdate. + */ +public final class FleetsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_CreateOrUpdate_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .define("production-fleet-01") + .withRegion("East US") + .withExistingResourceGroup("rg-database-fleet-manager") + .withTags(mapOf("environment", "production", "owner", "team-database")) + .withProperties( + new FleetProperties().withDescription("Production fleet for high availability and scalability.")) + .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; + } +} +``` + +### Fleets_GetByResourceGroup + +```java +/** + * Samples for FleetDatabases Get. + */ +public final class FleetDatabasesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Retrieve Database Details in Fleet - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void retrieveDatabaseDetailsInFleetGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .getWithResponse("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_List + +```java +/** + * Samples for FleetTiers Disable. + */ +public final class FleetTiersDisableSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Disable_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Disable_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersDisableMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .disableWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_ListByResourceGroup + +```java +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets Update. + */ +public final class FleetsUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + Fleet resource = manager.fleets() + .getByResourceGroupWithResponse("rg-database-fleet-manager", "critical-production-fleet", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("environment", "production", "owner", "team-database")) + .withProperties(new FleetProperties().withDescription( + "Fleet containing critical production databases and high availability configurations.")) + .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; + } +} +``` + +### Fleets_Update + +```java +/** + * Samples for Fleetspaces ListByFleet. + */ +public final class FleetspacesListByFleetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_ListByFleet_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_ListByFleet_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesListByFleetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .listByFleet("rg-database-fleet-manager", "production-fleet", 27L, 7L, "qaorjlbhvuntmn", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleetspaces_CreateOrUpdate + +```java +/** + * Samples for Fleets GetByResourceGroup. + */ +public final class FleetsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .getByResourceGroupWithResponse("rg-database-fleet-manager", "production-fleet-01", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleetspaces_Delete + +```java +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; + +/** + * Samples for FleetTiers CreateOrUpdate. + */ +public final class FleetTiersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_CreateOrUpdate_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .define("general-purpose-tier") + .withExistingFleet("rg-database-fleet-manager", "critical-production-fleet") + .withProperties(new FleetTierProperties().withServerless(false) + .withPooled(true) + .withServiceTier("GeneralPurpose") + .withFamily("Gen5") + .withCapacity(4) + .withPoolNumOfDatabasesMax(10) + .withHighAvailabilityReplicaCount(5) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(0.0D) + .withDatabaseCapacityMax(4.0D) + .withDatabaseSizeGbMax(50)) + .create(); + } +} +``` + +### Fleetspaces_Get + +```java +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseCreateMode; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabase; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabaseProperties; +import com.azure.resourcemanager.databasefleetmanager.models.Identity; +import com.azure.resourcemanager.databasefleetmanager.models.IdentityType; +import com.azure.resourcemanager.databasefleetmanager.models.TransparentDataEncryption; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FleetDatabases Update. + */ +public final class FleetDatabasesUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Update Database in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void updateDatabaseInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + FleetDatabase resource = manager.fleetDatabases() + .getWithResponse("rgdatabasefleetmanager", "production-fleet", "primary-space", "customer-database-prod", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetDatabaseProperties().withCreateMode(DatabaseCreateMode.DEFAULT) + .withTierName("Standard") + .withRestoreFromTime(OffsetDateTime.parse("2024-11-06T09:16:05.048Z")) + .withSourceDatabaseName("customer-database-staging") + .withResourceTags(mapOf("environment", "production", "owner", "database-team")) + .withIdentity(new Identity().withIdentityType(IdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(Arrays.asList(new DatabaseIdentity().withResourceId( + "/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourcegroups/rgdatabasefleetmanager/providers/Microsoft.ManagedIdentity/userAssignedIdentities/db-identity") + .withPrincipalId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withClientId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"))) + .withFederatedClientId("a2b3c4d5-6789-0123-4567-89abcdef1234")) + .withTransparentDataEncryption(new TransparentDataEncryption().withKeyUri("fakeTokenPlaceholder") + .withKeys(Arrays.asList("abc123", "xyz789")) + .withEnableAutoRotation(true))) + .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; + } +} +``` + +### Fleetspaces_ListByFleet + +```java +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; + +/** + * Samples for Fleetspaces Update. + */ +public final class FleetspacesUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + Fleetspace resource = manager.fleetspaces() + .getWithResponse("rg-database-fleet-manager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetspaceProperties().withCapacityMax(150000) + .withMainPrincipal(new MainPrincipal().withLogin("adminUser") + .withApplicationId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39") + .withObjectId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withTenantId("bde45d44-ec42-45b8-a5a2-c5b998c65ef6") + .withPrincipalType(PrincipalType.APPLICATION))) + .apply(); + } +} +``` + +### Fleetspaces_RegisterServer + +```java +/** + * Samples for Fleetspaces Get. + */ +public final class FleetspacesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .getWithResponse("rgdatabasefleetmanager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleetspaces_Unregister + +```java +/** + * Samples for FleetTiers Get. + */ +public final class FleetTiersGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .getWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} +``` + +### Fleetspaces_Update + +```java +/** + * Samples for FleetDatabases Revert. + */ +public final class FleetDatabasesRevertSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Revert_MaximumSet_Gen.json + */ + /** + * Sample code: Revert Transparent Data Encryption in Database - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void revertTransparentDataEncryptionInDatabaseGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .revert("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .define("allow-10-0-0-0-24-to-10-1-0-0-24") + .withExistingFleetspace("rg-networking-operations", "data-fleet-01", "prod-environment") + .withProperties(new FirewallRuleProperties().withStartIpAddress("10.0.0.0").withEndIpAddress("10.0.0.255")) + .create(); + } +} +``` + diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/pom.xml b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/pom.xml new file mode 100644 index 000000000000..da6972226fc3 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/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-databasefleetmanager + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for databasefleetmanager Management + This package contains Microsoft Azure SDK for databasefleetmanager Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Database Fleet Client. + 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.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/DatabasefleetmanagerManager.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/DatabasefleetmanagerManager.java new file mode 100644 index 000000000000..ae2b2ff507c9 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/DatabasefleetmanagerManager.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager; + +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.databasefleetmanager.fluent.DatabaseFleetManagerClient; +import com.azure.resourcemanager.databasefleetmanager.implementation.DatabaseFleetManagerClientBuilder; +import com.azure.resourcemanager.databasefleetmanager.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.databasefleetmanager.implementation.FleetDatabasesImpl; +import com.azure.resourcemanager.databasefleetmanager.implementation.FleetTiersImpl; +import com.azure.resourcemanager.databasefleetmanager.implementation.FleetsImpl; +import com.azure.resourcemanager.databasefleetmanager.implementation.FleetspacesImpl; +import com.azure.resourcemanager.databasefleetmanager.implementation.OperationsImpl; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRules; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabases; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTiers; +import com.azure.resourcemanager.databasefleetmanager.models.Fleets; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspaces; +import com.azure.resourcemanager.databasefleetmanager.models.Operations; +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 DatabasefleetmanagerManager. + * Database Fleet Client. + */ +public final class DatabasefleetmanagerManager { + private Operations operations; + + private FleetDatabases fleetDatabases; + + private Fleetspaces fleetspaces; + + private Fleets fleets; + + private FirewallRules firewallRules; + + private FleetTiers fleetTiers; + + private final DatabaseFleetManagerClient clientObject; + + private DatabasefleetmanagerManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DatabaseFleetManagerClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of databasefleetmanager service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the databasefleetmanager service API instance. + */ + public static DatabasefleetmanagerManager 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 databasefleetmanager service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the databasefleetmanager service API instance. + */ + public static DatabasefleetmanagerManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DatabasefleetmanagerManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DatabasefleetmanagerManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DatabasefleetmanagerManager.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-databasefleetmanager.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 databasefleetmanager service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the databasefleetmanager service API instance. + */ + public DatabasefleetmanagerManager 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.databasefleetmanager") + .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 DatabasefleetmanagerManager(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 FleetDatabases. It manages FleetDatabase. + * + * @return Resource collection API of FleetDatabases. + */ + public FleetDatabases fleetDatabases() { + if (this.fleetDatabases == null) { + this.fleetDatabases = new FleetDatabasesImpl(clientObject.getFleetDatabases(), this); + } + return fleetDatabases; + } + + /** + * Gets the resource collection API of Fleetspaces. It manages Fleetspace. + * + * @return Resource collection API of Fleetspaces. + */ + public Fleetspaces fleetspaces() { + if (this.fleetspaces == null) { + this.fleetspaces = new FleetspacesImpl(clientObject.getFleetspaces(), this); + } + return fleetspaces; + } + + /** + * Gets the resource collection API of Fleets. It manages Fleet. + * + * @return Resource collection API of Fleets. + */ + public Fleets fleets() { + if (this.fleets == null) { + this.fleets = new FleetsImpl(clientObject.getFleets(), this); + } + return fleets; + } + + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** + * Gets the resource collection API of FleetTiers. It manages FleetTier. + * + * @return Resource collection API of FleetTiers. + */ + public FleetTiers fleetTiers() { + if (this.fleetTiers == null) { + this.fleetTiers = new FleetTiersImpl(clientObject.getFleetTiers(), this); + } + return fleetTiers; + } + + /** + * Gets wrapped service client DatabaseFleetManagerClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client DatabaseFleetManagerClient. + */ + public DatabaseFleetManagerClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/DatabaseFleetManagerClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/DatabaseFleetManagerClient.java new file mode 100644 index 000000000000..d053f3bbf905 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/DatabaseFleetManagerClient.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DatabaseFleetManagerClient class. + */ +public interface DatabaseFleetManagerClient { + /** + * 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 FleetDatabasesClient object to access its operations. + * + * @return the FleetDatabasesClient object. + */ + FleetDatabasesClient getFleetDatabases(); + + /** + * Gets the FleetspacesClient object to access its operations. + * + * @return the FleetspacesClient object. + */ + FleetspacesClient getFleetspaces(); + + /** + * Gets the FleetsClient object to access its operations. + * + * @return the FleetsClient object. + */ + FleetsClient getFleets(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the FleetTiersClient object to access its operations. + * + * @return the FleetTiersClient object. + */ + FleetTiersClient getFleetTiers(); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FirewallRulesClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FirewallRulesClient.java new file mode 100644 index 000000000000..5eb74d5f64b1 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FirewallRulesClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.FirewallRuleInner; + +/** + * An instance of this class provides access to all the operations defined in FirewallRulesClient. + */ +public interface FirewallRulesClient { + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, Context context); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName); + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String firewallRuleName, FirewallRuleInner resource); + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String firewallRuleName, FirewallRuleInner resource, Context context); + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, FirewallRuleInner resource); + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, FirewallRuleInner resource, Context context); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName, + String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName, + String firewallRuleName, Context context); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String firewallRuleName, + Context context); + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName); + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, String fleetspaceName, + Long skip, Long top, String skiptoken, Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetDatabasesClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetDatabasesClient.java new file mode 100644 index 000000000000..3b15fc593563 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetDatabasesClient.java @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.FleetDatabaseInner; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; + +/** + * An instance of this class provides access to all the operations defined in FleetDatabasesClient. + */ +public interface FleetDatabasesClient { + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, Context context); + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetDatabaseInner get(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName); + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetDatabaseInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner resource); + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetDatabaseInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner resource, Context context); + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetDatabaseInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner resource); + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetDatabaseInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner resource, Context context); + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetDatabaseInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties); + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetDatabaseInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties, Context context); + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetDatabaseInner update(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + FleetDatabaseInner properties); + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetDatabaseInner update(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + FleetDatabaseInner properties, Context context); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName, + String databaseName); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName, + String databaseName, Context context); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String databaseName); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String databaseName, + Context context); + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName); + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String filter, String skiptoken, Context context); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginChangeTier(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginChangeTier(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body, Context context); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body, Context context); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginRename(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseRenameProperties body); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRename(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseRenameProperties body, Context context); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body, Context context); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginRevert(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginRevert(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, Context context); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetTiersClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetTiersClient.java new file mode 100644 index 000000000000..6273415cedb8 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetTiersClient.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.FleetTierInner; + +/** + * An instance of this class provides access to all the operations defined in FleetTiersClient. + */ +public interface FleetTiersClient { + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context); + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner get(String resourceGroupName, String fleetName, String tierName); + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetTierInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource); + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetTierInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource, Context context); + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner createOrUpdate(String resourceGroupName, String fleetName, String tierName, FleetTierInner resource); + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner createOrUpdate(String resourceGroupName, String fleetName, String tierName, FleetTierInner resource, + Context context); + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetTierInner> beginUpdate(String resourceGroupName, String fleetName, + String tierName, FleetTierInner properties); + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetTierInner> beginUpdate(String resourceGroupName, String fleetName, + String tierName, FleetTierInner properties, Context context); + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner update(String resourceGroupName, String fleetName, String tierName, FleetTierInner properties); + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner update(String resourceGroupName, String fleetName, String tierName, FleetTierInner properties, + Context context); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String tierName); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String tierName, + Context context); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String tierName); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String tierName, Context context); + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleet(String resourceGroupName, String fleetName); + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context); + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disableWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context); + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetTierInner disable(String resourceGroupName, String fleetName, String tierName); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetsClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetsClient.java new file mode 100644 index 000000000000..e8fe2fcb0e7e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetsClient.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.FleetInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetUpdate; + +/** + * An instance of this class provides access to all the operations defined in FleetsClient. + */ +public interface FleetsClient { + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, Context context); + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner getByResourceGroup(String resourceGroupName, String fleetName); + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, String fleetName, + FleetInner resource); + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, String fleetName, + FleetInner resource, Context context); + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource); + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource, Context context); + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties); + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties, Context context); + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties); + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties, Context context); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, Context context); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, Context context); + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Long skip, Long top, String skiptoken, + Context context); + + /** + * Gets all fleets in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all fleets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetspacesClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetspacesClient.java new file mode 100644 index 000000000000..96882ffb2c00 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/FleetspacesClient.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.FleetspaceInner; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; + +/** + * An instance of this class provides access to all the operations defined in FleetspacesClient. + */ +public interface FleetspacesClient { + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + Context context); + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetspaceInner get(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetspaceInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource); + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetspaceInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource, Context context); + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetspaceInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource); + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetspaceInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource, Context context); + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetspaceInner> beginUpdate(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner properties); + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetspaceInner> beginUpdate(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner properties, Context context); + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetspaceInner update(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties); + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetspaceInner update(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties, Context context); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 fleetName, String fleetspaceName, + Context context); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, Context context); + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleet(String resourceGroupName, String fleetName); + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginRegisterServer(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRegisterServer(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body, Context context); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body, Context context); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginUnregister(String resourceGroupName, String fleetName, + String fleetspaceName); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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> beginUnregister(String resourceGroupName, String fleetName, + String fleetspaceName, Context context); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 unregister(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 unregister(String resourceGroupName, String fleetName, String fleetspaceName, Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/OperationsClient.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/OperationsClient.java new file mode 100644 index 000000000000..19e73b22d00b --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FirewallRuleInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FirewallRuleInner.java new file mode 100644 index 000000000000..fcbcc59f1de6 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FirewallRuleInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.models.FirewallRuleProperties; +import java.io.IOException; + +/** + * A firewall rule. + */ +@Fluent +public final class FirewallRuleInner extends ProxyResource { + /* + * A Firewall rule properties. + */ + private FirewallRuleProperties 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 FirewallRuleInner class. + */ + public FirewallRuleInner() { + } + + /** + * Get the properties property: A Firewall rule properties. + * + * @return the properties value. + */ + public FirewallRuleProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A Firewall rule properties. + * + * @param properties the properties value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withProperties(FirewallRuleProperties 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleInner 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 FirewallRuleInner. + */ + public static FirewallRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleInner deserializedFirewallRuleInner = new FirewallRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFirewallRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFirewallRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFirewallRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFirewallRuleInner.properties = FirewallRuleProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFirewallRuleInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetDatabaseInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetDatabaseInner.java new file mode 100644 index 000000000000..2f2194a96521 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetDatabaseInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.models.FleetDatabaseProperties; +import java.io.IOException; + +/** + * A fleet database. + */ +@Fluent +public final class FleetDatabaseInner extends ProxyResource { + /* + * Fleet database properties. + */ + private FleetDatabaseProperties 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 FleetDatabaseInner class. + */ + public FleetDatabaseInner() { + } + + /** + * Get the properties property: Fleet database properties. + * + * @return the properties value. + */ + public FleetDatabaseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Fleet database properties. + * + * @param properties the properties value to set. + * @return the FleetDatabaseInner object itself. + */ + public FleetDatabaseInner withProperties(FleetDatabaseProperties 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetDatabaseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetDatabaseInner 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 FleetDatabaseInner. + */ + public static FleetDatabaseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetDatabaseInner deserializedFleetDatabaseInner = new FleetDatabaseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFleetDatabaseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFleetDatabaseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFleetDatabaseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFleetDatabaseInner.properties = FleetDatabaseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFleetDatabaseInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetDatabaseInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetInner.java new file mode 100644 index 000000000000..1793ee658774 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.models.FleetProperties; +import java.io.IOException; +import java.util.Map; + +/** + * A Database Fleet. + */ +@Fluent +public final class FleetInner extends Resource { + /* + * The fleet properties. + */ + private FleetProperties 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 FleetInner class. + */ + public FleetInner() { + } + + /** + * Get the properties property: The fleet properties. + * + * @return the properties value. + */ + public FleetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The fleet properties. + * + * @param properties the properties value to set. + * @return the FleetInner object itself. + */ + public FleetInner withProperties(FleetProperties 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 FleetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FleetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetInner 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 FleetInner. + */ + public static FleetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetInner deserializedFleetInner = new FleetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFleetInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFleetInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFleetInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedFleetInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedFleetInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedFleetInner.properties = FleetProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFleetInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetTierInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetTierInner.java new file mode 100644 index 000000000000..d74675c2a8f3 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetTierInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.models.FleetTierProperties; +import java.io.IOException; + +/** + * A SQL Database Fleet tier. + */ +@Fluent +public final class FleetTierInner extends ProxyResource { + /* + * A Fleet tier properties. + */ + private FleetTierProperties 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 FleetTierInner class. + */ + public FleetTierInner() { + } + + /** + * Get the properties property: A Fleet tier properties. + * + * @return the properties value. + */ + public FleetTierProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A Fleet tier properties. + * + * @param properties the properties value to set. + * @return the FleetTierInner object itself. + */ + public FleetTierInner withProperties(FleetTierProperties 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetTierInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetTierInner 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 FleetTierInner. + */ + public static FleetTierInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetTierInner deserializedFleetTierInner = new FleetTierInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFleetTierInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFleetTierInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFleetTierInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFleetTierInner.properties = FleetTierProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFleetTierInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetTierInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetspaceInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetspaceInner.java new file mode 100644 index 000000000000..f72e3a3c69c2 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/FleetspaceInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.models.FleetspaceProperties; +import java.io.IOException; + +/** + * A fleetspace. + */ +@Fluent +public final class FleetspaceInner extends ProxyResource { + /* + * A Fleetspace properties. + */ + private FleetspaceProperties 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 FleetspaceInner class. + */ + public FleetspaceInner() { + } + + /** + * Get the properties property: A Fleetspace properties. + * + * @return the properties value. + */ + public FleetspaceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: A Fleetspace properties. + * + * @param properties the properties value to set. + * @return the FleetspaceInner object itself. + */ + public FleetspaceInner withProperties(FleetspaceProperties 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetspaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetspaceInner 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 FleetspaceInner. + */ + public static FleetspaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetspaceInner deserializedFleetspaceInner = new FleetspaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFleetspaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFleetspaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFleetspaceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFleetspaceInner.properties = FleetspaceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFleetspaceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetspaceInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/OperationInner.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/OperationInner.java new file mode 100644 index 000000000000..97550c82e7e7 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/OperationInner.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.databasefleetmanager.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.databasefleetmanager.models.ActionType; +import com.azure.resourcemanager.databasefleetmanager.models.OperationDisplay; +import com.azure.resourcemanager.databasefleetmanager.models.Origin; +import java.io.IOException; + +/** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/package-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/package-info.java new file mode 100644 index 000000000000..3c19252a0acf --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Databasefleetmanager. + * Database Fleet Client. + */ +package com.azure.resourcemanager.databasefleetmanager.fluent.models; diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/package-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/package-info.java new file mode 100644 index 000000000000..06a7ca1c8894 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Databasefleetmanager. + * Database Fleet Client. + */ +package com.azure.resourcemanager.databasefleetmanager.fluent; diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientBuilder.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientBuilder.java new file mode 100644 index 000000000000..ceefe039061e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientBuilder.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.databasefleetmanager.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 DatabaseFleetManagerClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DatabaseFleetManagerClientImpl.class }) +public final class DatabaseFleetManagerClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder 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 DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder 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 DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder 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 DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder 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 DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder 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 DatabaseFleetManagerClientBuilder. + */ + public DatabaseFleetManagerClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DatabaseFleetManagerClientImpl with the provided parameters. + * + * @return an instance of DatabaseFleetManagerClientImpl. + */ + public DatabaseFleetManagerClientImpl 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(); + DatabaseFleetManagerClientImpl client = new DatabaseFleetManagerClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientImpl.java new file mode 100644 index 000000000000..ae28d8c9e32d --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/DatabaseFleetManagerClientImpl.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.databasefleetmanager.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.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.databasefleetmanager.fluent.DatabaseFleetManagerClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.FirewallRulesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetDatabasesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetTiersClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetsClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetspacesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.OperationsClient; +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 DatabaseFleetManagerClientImpl type. + */ +@ServiceClient(builder = DatabaseFleetManagerClientBuilder.class) +public final class DatabaseFleetManagerClientImpl implements DatabaseFleetManagerClient { + /** + * 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 FleetDatabasesClient object to access its operations. + */ + private final FleetDatabasesClient fleetDatabases; + + /** + * Gets the FleetDatabasesClient object to access its operations. + * + * @return the FleetDatabasesClient object. + */ + public FleetDatabasesClient getFleetDatabases() { + return this.fleetDatabases; + } + + /** + * The FleetspacesClient object to access its operations. + */ + private final FleetspacesClient fleetspaces; + + /** + * Gets the FleetspacesClient object to access its operations. + * + * @return the FleetspacesClient object. + */ + public FleetspacesClient getFleetspaces() { + return this.fleetspaces; + } + + /** + * The FleetsClient object to access its operations. + */ + private final FleetsClient fleets; + + /** + * Gets the FleetsClient object to access its operations. + * + * @return the FleetsClient object. + */ + public FleetsClient getFleets() { + return this.fleets; + } + + /** + * The FirewallRulesClient object to access its operations. + */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** + * The FleetTiersClient object to access its operations. + */ + private final FleetTiersClient fleetTiers; + + /** + * Gets the FleetTiersClient object to access its operations. + * + * @return the FleetTiersClient object. + */ + public FleetTiersClient getFleetTiers() { + return this.fleetTiers; + } + + /** + * Initializes an instance of DatabaseFleetManagerClient 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. + */ + DatabaseFleetManagerClientImpl(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 = "2025-02-01-preview"; + this.operations = new OperationsClientImpl(this); + this.fleetDatabases = new FleetDatabasesClientImpl(this); + this.fleetspaces = new FleetspacesClientImpl(this); + this.fleets = new FleetsClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.fleetTiers = new FleetTiersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseFleetManagerClientImpl.class); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRuleImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRuleImpl.java new file mode 100644 index 000000000000..aa6a971f5b77 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRuleImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRule; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FirewallRuleProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String fleetName; + + private String fleetspaceName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingFleetspace(String resourceGroupName, String fleetName, String fleetspaceName) { + this.resourceGroupName = resourceGroupName; + this.fleetName = fleetName; + this.fleetspaceName = fleetspaceName; + return this; + } + + public FirewallRule create() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, this.innerModel(), + Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(String name, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, this.innerModel(), + Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(FirewallRuleInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.fleetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleets"); + this.fleetspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleetspaces"); + this.firewallRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withProperties(FirewallRuleProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesClientImpl.java new file mode 100644 index 000000000000..01bcd6248e1f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1042 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.databasefleetmanager.fluent.FirewallRulesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FirewallRuleListResult; +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 FirewallRulesClient. + */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FirewallRulesService service; + + /** + * The service client containing this operation class. + */ + private final DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(DatabaseFleetManagerClientImpl client) { + this.service + = RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface FirewallRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FirewallRuleInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetspace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @QueryParam("$skip") Long skip, + @QueryParam("$top") Long top, @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, firewallRuleName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, firewallRuleName, accept, context); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context).block(); + } + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName) { + return getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, Context.NONE).getValue(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, FirewallRuleInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, firewallRuleName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, FirewallRuleInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, firewallRuleName, + contentType, accept, resource, context); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName, + FirewallRuleInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FirewallRuleInner.class, FirewallRuleInner.class, this.client.getContext()); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName, + FirewallRuleInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, + fleetspaceName, firewallRuleName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FirewallRuleInner.class, FirewallRuleInner.class, context); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String firewallRuleName, FirewallRuleInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource) + .getSyncPoller(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String firewallRuleName, FirewallRuleInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource, context) + .getSyncPoller(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, FirewallRuleInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String firewallRuleName, FirewallRuleInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, FirewallRuleInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource).block(); + } + + /** + * Creates or updates a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param resource The firewall rule object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, FirewallRuleInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource, context) + .block(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, firewallRuleName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, firewallRuleName, accept, context); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String firewallRuleName, Context context) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context) + .getSyncPoller(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName, + String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName, + String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName, String firewallRuleName) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName).block(); + } + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName, String firewallRuleName, + Context context) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context).block(); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceSinglePageAsync(String resourceGroupName, + String fleetName, String fleetspaceName, Long skip, Long top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken, + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceSinglePageAsync(String resourceGroupName, + String fleetName, String fleetspaceName, Long skip, Long top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFleetspace(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String skiptoken) { + return new PagedFlux<>( + () -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken), + nextLink -> listByFleetspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken), + nextLink -> listByFleetspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String skiptoken, Context context) { + return new PagedFlux<>(() -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, + top, skiptoken, context), nextLink -> listByFleetspaceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedIterable<>( + listByFleetspaceAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken)); + } + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String skiptoken, Context context) { + return new PagedIterable<>( + listByFleetspaceAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken, 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 FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FirewallRule list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByFleetspaceNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesImpl.java new file mode 100644 index 000000000000..5db95356f9b4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FirewallRulesImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.FirewallRulesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRule; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRules; + +public final class FirewallRulesImpl implements FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public FirewallRulesImpl(FirewallRulesClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FirewallRule get(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName) { + FirewallRuleInner inner + = this.serviceClient().get(resourceGroupName, fleetName, fleetspaceName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName, firewallRuleName); + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName, + Context context) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context); + } + + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName) { + PagedIterable inner + = this.serviceClient().listByFleetspace(resourceGroupName, fleetName, fleetspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient() + .listByFleetspace(resourceGroupName, fleetName, fleetspaceName, skip, top, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public FirewallRule 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabaseImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabaseImpl.java new file mode 100644 index 000000000000..de7e38855939 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabaseImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetDatabaseInner; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabase; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabaseProperties; + +public final class FleetDatabaseImpl implements FleetDatabase, FleetDatabase.Definition, FleetDatabase.Update { + private FleetDatabaseInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FleetDatabaseProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FleetDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String fleetName; + + private String fleetspaceName; + + private String databaseName; + + public FleetDatabaseImpl withExistingFleetspace(String resourceGroupName, String fleetName, String fleetspaceName) { + this.resourceGroupName = resourceGroupName; + this.fleetName = fleetName; + this.fleetspaceName = fleetspaceName; + return this; + } + + public FleetDatabase create() { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, databaseName, this.innerModel(), + Context.NONE); + return this; + } + + public FleetDatabase create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, databaseName, this.innerModel(), context); + return this; + } + + FleetDatabaseImpl(String name, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = new FleetDatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public FleetDatabaseImpl update() { + return this; + } + + public FleetDatabase apply() { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .update(resourceGroupName, fleetName, fleetspaceName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public FleetDatabase apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .update(resourceGroupName, fleetName, fleetspaceName, databaseName, this.innerModel(), context); + return this; + } + + FleetDatabaseImpl(FleetDatabaseInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.fleetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleets"); + this.fleetspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleetspaces"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public FleetDatabase refresh() { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public FleetDatabase refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetDatabases() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, context) + .getValue(); + return this; + } + + public void changeTier(DatabaseChangeTierProperties body) { + serviceManager.fleetDatabases().changeTier(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + } + + public void changeTier(DatabaseChangeTierProperties body, Context context) { + serviceManager.fleetDatabases() + .changeTier(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + } + + public void rename(DatabaseRenameProperties body) { + serviceManager.fleetDatabases().rename(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + } + + public void rename(DatabaseRenameProperties body, Context context) { + serviceManager.fleetDatabases() + .rename(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + } + + public void revert() { + serviceManager.fleetDatabases().revert(resourceGroupName, fleetName, fleetspaceName, databaseName); + } + + public void revert(Context context) { + serviceManager.fleetDatabases().revert(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + } + + public FleetDatabaseImpl withProperties(FleetDatabaseProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesClientImpl.java new file mode 100644 index 000000000000..40628c0af488 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesClientImpl.java @@ -0,0 +1,2129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetDatabasesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetDatabaseInner; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetDatabaseListResult; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; +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 FleetDatabasesClient. + */ +public final class FleetDatabasesClientImpl implements FleetDatabasesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FleetDatabasesService service; + + /** + * The service client containing this operation class. + */ + private final DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of FleetDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FleetDatabasesClientImpl(DatabaseFleetManagerClientImpl client) { + this.service + = RestProxy.create(FleetDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientFleetDatabases to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface FleetDatabasesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FleetDatabaseInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FleetDatabaseInner properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetspace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @QueryParam("$skip") Long skip, + @QueryParam("$top") Long top, @QueryParam("$filter") String filter, + @QueryParam("$skiptoken") String skiptoken, @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/changeTier") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> changeTier(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DatabaseChangeTierProperties body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/rename") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> rename(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DatabaseRenameProperties body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/revert") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revert(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, databaseName, accept, context); + } + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context).block(); + } + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetDatabaseInner get(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName) { + return getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, Context.NONE).getValue(); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, contentType, + accept, resource, context); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + FleetDatabaseInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetDatabaseInner.class, FleetDatabaseInner.class, this.client.getContext()); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + FleetDatabaseInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, + fleetspaceName, databaseName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetDatabaseInner.class, FleetDatabaseInner.class, context); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetDatabaseInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource) + .getSyncPoller(); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetDatabaseInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource, context) + .getSyncPoller(); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetDatabaseInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource).block(); + } + + /** + * Creates or updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param resource The database object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetDatabaseInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, resource, context) + .block(); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, + contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, FleetDatabaseInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, databaseName, contentType, accept, properties, context); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetDatabaseInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetDatabaseInner.class, FleetDatabaseInner.class, this.client.getContext()); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetDatabaseInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetDatabaseInner.class, FleetDatabaseInner.class, context); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetDatabaseInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties) { + return this.beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties) + .getSyncPoller(); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleet database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetDatabaseInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, String databaseName, FleetDatabaseInner properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties, context) + .getSyncPoller(); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner properties) { + return beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner properties, Context context) { + return beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetDatabaseInner update(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner properties) { + return updateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties).block(); + } + + /** + * Updates a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param properties The database object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetDatabaseInner update(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, FleetDatabaseInner properties, Context context) { + return updateAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, properties, context).block(); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, databaseName, accept, context); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).getSyncPoller(); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, String databaseName, Context context) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context) + .getSyncPoller(); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName, + String databaseName) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName, + String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName, String databaseName) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).block(); + } + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName, String databaseName, + Context context) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context).block(); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceSinglePageAsync(String resourceGroupName, + String fleetName, String fleetspaceName, Long skip, Long top, String filter, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, skip, top, filter, + skiptoken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceSinglePageAsync(String resourceGroupName, + String fleetName, String fleetspaceName, Long skip, Long top, String filter, String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFleetspace(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, skip, top, filter, skiptoken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String filter, String skiptoken) { + return new PagedFlux<>(() -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, + top, filter, skiptoken), nextLink -> listByFleetspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName) { + final Long skip = null; + final Long top = null; + final String filter = null; + final String skiptoken = null; + return new PagedFlux<>(() -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, + top, filter, skiptoken), nextLink -> listByFleetspaceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetspaceAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String filter, String skiptoken, Context context) { + return new PagedFlux<>(() -> listByFleetspaceSinglePageAsync(resourceGroupName, fleetName, fleetspaceName, skip, + top, filter, skiptoken, context), nextLink -> listByFleetspaceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName) { + final Long skip = null; + final Long top = null; + final String filter = null; + final String skiptoken = null; + return new PagedIterable<>( + listByFleetspaceAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, filter, skiptoken)); + } + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String filter, String skiptoken, Context context) { + return new PagedIterable<>( + listByFleetspaceAsync(resourceGroupName, fleetName, fleetspaceName, skip, top, filter, skiptoken, context)); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> changeTierWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.changeTier(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> changeTierWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.changeTier(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, contentType, + accept, body, context); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginChangeTierAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body) { + Mono>> mono + = changeTierWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginChangeTierAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = changeTierWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginChangeTier(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body) { + return this.beginChangeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body) + .getSyncPoller(); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginChangeTier(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseChangeTierProperties body, Context context) { + return this.beginChangeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context) + .getSyncPoller(); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 changeTierAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseChangeTierProperties body) { + return beginChangeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono changeTierAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseChangeTierProperties body, Context context) { + return beginChangeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body) { + changeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body).block(); + } + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body, Context context) { + changeTierAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context).block(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> renameWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.rename(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> renameWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.rename(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, databaseName, contentType, accept, body, context); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRenameAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body) { + Mono>> mono + = renameWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRenameAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = renameWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRename(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body) { + return this.beginRenameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body).getSyncPoller(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRename(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, DatabaseRenameProperties body, Context context) { + return this.beginRenameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context) + .getSyncPoller(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 renameAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseRenameProperties body) { + return beginRenameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono renameAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, DatabaseRenameProperties body, Context context) { + return beginRenameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body) { + renameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body).block(); + } + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body, Context context) { + renameAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context).block(); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revertWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.revert(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, databaseName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> revertWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.revert(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, databaseName, accept, context); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRevertAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName) { + Mono>> mono + = revertWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRevertAsync(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = revertWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRevert(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName) { + return this.beginRevertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).getSyncPoller(); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRevert(String resourceGroupName, String fleetName, + String fleetspaceName, String databaseName, Context context) { + return this.beginRevertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context) + .getSyncPoller(); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revertAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName) { + return beginRevertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 revertAsync(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, Context context) { + return beginRevertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName) { + revertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName).block(); + } + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + Context context) { + revertAsync(resourceGroupName, fleetName, fleetspaceName, databaseName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FleetDatabase list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FleetDatabase list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetspaceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByFleetspaceNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesImpl.java new file mode 100644 index 000000000000..158cc76da4f5 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetDatabasesImpl.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.databasefleetmanager.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.databasefleetmanager.fluent.FleetDatabasesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetDatabaseInner; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabase; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabases; + +public final class FleetDatabasesImpl implements FleetDatabases { + private static final ClientLogger LOGGER = new ClientLogger(FleetDatabasesImpl.class); + + private final FleetDatabasesClient innerClient; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public FleetDatabasesImpl(FleetDatabasesClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FleetDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FleetDatabase get(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName) { + FleetDatabaseInner inner = this.serviceClient().get(resourceGroupName, fleetName, fleetspaceName, databaseName); + if (inner != null) { + return new FleetDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName, databaseName); + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + Context context) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + } + + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName) { + PagedIterable inner + = this.serviceClient().listByFleetspace(resourceGroupName, fleetName, fleetspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByFleetspace(String resourceGroupName, String fleetName, + String fleetspaceName, Long skip, Long top, String filter, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient() + .listByFleetspace(resourceGroupName, fleetName, fleetspaceName, skip, top, filter, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetDatabaseImpl(inner1, this.manager())); + } + + public void changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body) { + this.serviceClient().changeTier(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + } + + public void changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body, Context context) { + this.serviceClient().changeTier(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + } + + public void rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body) { + this.serviceClient().rename(resourceGroupName, fleetName, fleetspaceName, databaseName, body); + } + + public void rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body, Context context) { + this.serviceClient().rename(resourceGroupName, fleetName, fleetspaceName, databaseName, body, context); + } + + public void revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName) { + this.serviceClient().revert(resourceGroupName, fleetName, fleetspaceName, databaseName); + } + + public void revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + Context context) { + this.serviceClient().revert(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + } + + public FleetDatabase 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, databaseName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, databaseName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, databaseName, context); + } + + private FleetDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + public FleetDatabaseImpl define(String name) { + return new FleetDatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetImpl.java new file mode 100644 index 000000000000..45489a39189e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import com.azure.resourcemanager.databasefleetmanager.models.FleetUpdate; +import java.util.Collections; +import java.util.Map; + +public final class FleetImpl implements Fleet, Fleet.Definition, Fleet.Update { + private FleetInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager 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 FleetProperties properties() { + return this.innerModel().properties(); + } + + 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 FleetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String fleetName; + + private FleetUpdate updateProperties; + + public FleetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Fleet create() { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .createOrUpdate(resourceGroupName, fleetName, this.innerModel(), Context.NONE); + return this; + } + + public Fleet create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .createOrUpdate(resourceGroupName, fleetName, this.innerModel(), context); + return this; + } + + FleetImpl(String name, com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = new FleetInner(); + this.serviceManager = serviceManager; + this.fleetName = name; + } + + public FleetImpl update() { + this.updateProperties = new FleetUpdate(); + return this; + } + + public Fleet apply() { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .update(resourceGroupName, fleetName, updateProperties, Context.NONE); + return this; + } + + public Fleet apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .update(resourceGroupName, fleetName, updateProperties, context); + return this; + } + + FleetImpl(FleetInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.fleetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleets"); + } + + public Fleet refresh() { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .getByResourceGroupWithResponse(resourceGroupName, fleetName, Context.NONE) + .getValue(); + return this; + } + + public Fleet refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleets() + .getByResourceGroupWithResponse(resourceGroupName, fleetName, context) + .getValue(); + return this; + } + + public FleetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public FleetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public FleetImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public FleetImpl withProperties(FleetProperties properties) { + if (isInCreateMode()) { + this.innerModel().withProperties(properties); + return this; + } else { + this.updateProperties.withProperties(properties); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTierImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTierImpl.java new file mode 100644 index 000000000000..8fbddb7e1589 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTierImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; + +public final class FleetTierImpl implements FleetTier, FleetTier.Definition, FleetTier.Update { + private FleetTierInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FleetTierProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FleetTierInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String fleetName; + + private String tierName; + + public FleetTierImpl withExistingFleet(String resourceGroupName, String fleetName) { + this.resourceGroupName = resourceGroupName; + this.fleetName = fleetName; + return this; + } + + public FleetTier create() { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .createOrUpdate(resourceGroupName, fleetName, tierName, this.innerModel(), Context.NONE); + return this; + } + + public FleetTier create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .createOrUpdate(resourceGroupName, fleetName, tierName, this.innerModel(), context); + return this; + } + + FleetTierImpl(String name, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = new FleetTierInner(); + this.serviceManager = serviceManager; + this.tierName = name; + } + + public FleetTierImpl update() { + return this; + } + + public FleetTier apply() { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .update(resourceGroupName, fleetName, tierName, this.innerModel(), Context.NONE); + return this; + } + + public FleetTier apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .update(resourceGroupName, fleetName, tierName, this.innerModel(), context); + return this; + } + + FleetTierImpl(FleetTierInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.fleetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleets"); + this.tierName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "tiers"); + } + + public FleetTier refresh() { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .getWithResponse(resourceGroupName, fleetName, tierName, Context.NONE) + .getValue(); + return this; + } + + public FleetTier refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetTiers() + .getWithResponse(resourceGroupName, fleetName, tierName, context) + .getValue(); + return this; + } + + public Response disableWithResponse(Context context) { + return serviceManager.fleetTiers().disableWithResponse(resourceGroupName, fleetName, tierName, context); + } + + public FleetTier disable() { + return serviceManager.fleetTiers().disable(resourceGroupName, fleetName, tierName); + } + + public FleetTierImpl withProperties(FleetTierProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersClientImpl.java new file mode 100644 index 000000000000..55f89489bd87 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersClientImpl.java @@ -0,0 +1,1354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetTiersClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetTierListResult; +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 FleetTiersClient. + */ +public final class FleetTiersClientImpl implements FleetTiersClient { + /** + * The proxy service used to perform REST calls. + */ + private final FleetTiersService service; + + /** + * The service client containing this operation class. + */ + private final DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of FleetTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FleetTiersClientImpl(DatabaseFleetManagerClientImpl client) { + this.service + = RestProxy.create(FleetTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientFleetTiers to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface FleetTiersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}") + @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("fleetName") String fleetName, + @PathParam("tierName") String tierName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}") + @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("fleetName") String fleetName, + @PathParam("tierName") String tierName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") FleetTierInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}") + @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("fleetName") String fleetName, + @PathParam("tierName") String tierName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") FleetTierInner properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}") + @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("fleetName") String fleetName, + @PathParam("tierName") String tierName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleet(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @QueryParam("$skip") Long skip, @QueryParam("$top") Long top, @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}/disable") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disable(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("tierName") String tierName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String tierName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, tierName, accept, context); + } + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String fleetName, String tierName) { + return getWithResponseAsync(resourceGroupName, fleetName, tierName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context) { + return getWithResponseAsync(resourceGroupName, fleetName, tierName, context).block(); + } + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner get(String resourceGroupName, String fleetName, String tierName) { + return getWithResponse(resourceGroupName, fleetName, tierName, Context.NONE).getValue(); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, FleetTierInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, FleetTierInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, contentType, accept, resource, + context); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetTierInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, tierName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetTierInner.class, FleetTierInner.class, this.client.getContext()); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetTierInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, tierName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetTierInner.class, FleetTierInner.class, context); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetTierInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, tierName, resource).getSyncPoller(); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetTierInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, tierName, resource, context).getSyncPoller(); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, String tierName, + FleetTierInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, tierName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, String tierName, + FleetTierInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, tierName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner createOrUpdate(String resourceGroupName, String fleetName, String tierName, + FleetTierInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, tierName, resource).block(); + } + + /** + * Creates or updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param resource The tier object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner createOrUpdate(String resourceGroupName, String fleetName, String tierName, + FleetTierInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, tierName, resource, context).block(); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, FleetTierInner properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, FleetTierInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, tierName, contentType, accept, properties, context); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetTierInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String tierName, FleetTierInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, tierName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetTierInner.class, FleetTierInner.class, this.client.getContext()); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetTierInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String tierName, FleetTierInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, tierName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetTierInner.class, FleetTierInner.class, context); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetTierInner> beginUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner properties) { + return this.beginUpdateAsync(resourceGroupName, fleetName, tierName, properties).getSyncPoller(); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetTierInner> beginUpdate(String resourceGroupName, + String fleetName, String tierName, FleetTierInner properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, fleetName, tierName, properties, context).getSyncPoller(); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String tierName, + FleetTierInner properties) { + return beginUpdateAsync(resourceGroupName, fleetName, tierName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String tierName, + FleetTierInner properties, Context context) { + return beginUpdateAsync(resourceGroupName, fleetName, tierName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner update(String resourceGroupName, String fleetName, String tierName, + FleetTierInner properties) { + return updateAsync(resourceGroupName, fleetName, tierName, properties).block(); + } + + /** + * Updates a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @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 SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner update(String resourceGroupName, String fleetName, String tierName, FleetTierInner properties, + Context context) { + return updateAsync(resourceGroupName, fleetName, tierName, properties, context).block(); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String tierName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String tierName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, tierName, accept, context); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String tierName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, fleetName, tierName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String tierName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, tierName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, String tierName) { + return this.beginDeleteAsync(resourceGroupName, fleetName, tierName).getSyncPoller(); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, String tierName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, fleetName, tierName, context).getSyncPoller(); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String tierName) { + return beginDeleteAsync(resourceGroupName, fleetName, tierName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String tierName, Context context) { + return beginDeleteAsync(resourceGroupName, fleetName, tierName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String tierName) { + deleteAsync(resourceGroupName, fleetName, tierName).block(); + } + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String tierName, Context context) { + deleteAsync(resourceGroupName, fleetName, tierName, context).block(); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetSinglePageAsync(String resourceGroupName, String fleetName, + Long skip, Long top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleet(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, skip, top, skiptoken, 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 tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetSinglePageAsync(String resourceGroupName, String fleetName, + Long skip, Long top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFleet(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, skip, top, skiptoken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken) { + return new PagedFlux<>(() -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken), + nextLink -> listByFleetNextSinglePageAsync(nextLink)); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedFlux<>(() -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken), + nextLink -> listByFleetNextSinglePageAsync(nextLink)); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken, context), + nextLink -> listByFleetNextSinglePageAsync(nextLink, context)); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleet(String resourceGroupName, String fleetName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedIterable<>(listByFleetAsync(resourceGroupName, fleetName, skip, top, skiptoken)); + } + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedIterable<>(listByFleetAsync(resourceGroupName, fleetName, skip, top, skiptoken, context)); + } + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableWithResponseAsync(String resourceGroupName, String fleetName, + String tierName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.disable(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, tierName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableWithResponseAsync(String resourceGroupName, String fleetName, + String tierName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (tierName == null) { + return Mono.error(new IllegalArgumentException("Parameter tierName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.disable(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, tierName, accept, context); + } + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync(String resourceGroupName, String fleetName, String tierName) { + return disableWithResponseAsync(resourceGroupName, fleetName, tierName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context) { + return disableWithResponseAsync(resourceGroupName, fleetName, tierName, context).block(); + } + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetTierInner disable(String resourceGroupName, String fleetName, String tierName) { + return disableWithResponse(resourceGroupName, fleetName, tierName, 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 FleetTier list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FleetTier list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByFleetNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersImpl.java new file mode 100644 index 000000000000..daf7c247b2ba --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetTiersImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.FleetTiersClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTiers; + +public final class FleetTiersImpl implements FleetTiers { + private static final ClientLogger LOGGER = new ClientLogger(FleetTiersImpl.class); + + private final FleetTiersClient innerClient; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public FleetTiersImpl(FleetTiersClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, fleetName, tierName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FleetTierImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FleetTier get(String resourceGroupName, String fleetName, String tierName) { + FleetTierInner inner = this.serviceClient().get(resourceGroupName, fleetName, tierName); + if (inner != null) { + return new FleetTierImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String fleetName, String tierName) { + this.serviceClient().delete(resourceGroupName, fleetName, tierName); + } + + public void delete(String resourceGroupName, String fleetName, String tierName, Context context) { + this.serviceClient().delete(resourceGroupName, fleetName, tierName, context); + } + + public PagedIterable listByFleet(String resourceGroupName, String fleetName) { + PagedIterable inner = this.serviceClient().listByFleet(resourceGroupName, fleetName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetTierImpl(inner1, this.manager())); + } + + public PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + PagedIterable inner + = this.serviceClient().listByFleet(resourceGroupName, fleetName, skip, top, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetTierImpl(inner1, this.manager())); + } + + public Response disableWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context) { + Response inner + = this.serviceClient().disableWithResponse(resourceGroupName, fleetName, tierName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FleetTierImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FleetTier disable(String resourceGroupName, String fleetName, String tierName) { + FleetTierInner inner = this.serviceClient().disable(resourceGroupName, fleetName, tierName); + if (inner != null) { + return new FleetTierImpl(inner, this.manager()); + } else { + return null; + } + } + + public FleetTier 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String tierName = ResourceManagerUtils.getValueFromIdByName(id, "tiers"); + if (tierName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tiers'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, tierName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String tierName = ResourceManagerUtils.getValueFromIdByName(id, "tiers"); + if (tierName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tiers'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, tierName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String tierName = ResourceManagerUtils.getValueFromIdByName(id, "tiers"); + if (tierName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tiers'.", id))); + } + this.delete(resourceGroupName, fleetName, tierName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String tierName = ResourceManagerUtils.getValueFromIdByName(id, "tiers"); + if (tierName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tiers'.", id))); + } + this.delete(resourceGroupName, fleetName, tierName, context); + } + + private FleetTiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + public FleetTierImpl define(String name) { + return new FleetTierImpl(name, this.manager()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsClientImpl.java new file mode 100644 index 000000000000..ba426edc837a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsClientImpl.java @@ -0,0 +1,1297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetsClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetListResult; +import com.azure.resourcemanager.databasefleetmanager.models.FleetUpdate; +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 FleetsClient. + */ +public final class FleetsClientImpl implements FleetsClient { + /** + * The proxy service used to perform REST calls. + */ + private final FleetsService service; + + /** + * The service client containing this operation class. + */ + private final DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of FleetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FleetsClientImpl(DatabaseFleetManagerClientImpl client) { + this.service = RestProxy.create(FleetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientFleets to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface FleetsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}") + @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("fleetName") String fleetName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}") + @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("fleetName") String fleetName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FleetInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}") + @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("fleetName") String fleetName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FleetUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}") + @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("fleetName") String fleetName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("$skip") Long skip, + @QueryParam("$top") Long top, @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DatabaseFleetManager/fleets") + @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("{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) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String fleetName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String fleetName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, accept, context); + } + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String fleetName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, fleetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, fleetName, context).block(); + } + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner getByResourceGroup(String resourceGroupName, String fleetName) { + return getByResourceGroupWithResponse(resourceGroupName, fleetName, Context.NONE).getValue(); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + FleetInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + FleetInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, contentType, accept, resource, context); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, FleetInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), FleetInner.class, + FleetInner.class, this.client.getContext()); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, FleetInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), FleetInner.class, + FleetInner.class, context); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, FleetInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, resource).getSyncPoller(); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, FleetInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, resource, context).getSyncPoller(); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, FleetInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, FleetInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, resource).block(); + } + + /** + * Creates or updates a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, resource, context).block(); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + FleetUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + FleetUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, contentType, accept, properties, context); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginUpdateAsync(String resourceGroupName, String fleetName, + FleetUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, fleetName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), FleetInner.class, + FleetInner.class, this.client.getContext()); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetInner> beginUpdateAsync(String resourceGroupName, String fleetName, + FleetUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), FleetInner.class, + FleetInner.class, context); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, fleetName, properties).getSyncPoller(); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Database Fleet. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, fleetName, properties, context).getSyncPoller(); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, FleetUpdate properties) { + return beginUpdateAsync(resourceGroupName, fleetName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, FleetUpdate properties, + Context context) { + return beginUpdateAsync(resourceGroupName, fleetName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties) { + return updateAsync(resourceGroupName, fleetName, properties).block(); + } + + /** + * Modifies a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param properties The fleet object to patch. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Database Fleet. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties, Context context) { + return updateAsync(resourceGroupName, fleetName, properties, context).block(); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, accept, context); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, fleetName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, fleetName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName) { + return this.beginDeleteAsync(resourceGroupName, fleetName).getSyncPoller(); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, Context context) { + return this.beginDeleteAsync(resourceGroupName, fleetName, context).getSyncPoller(); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName) { + return beginDeleteAsync(resourceGroupName, fleetName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, Context context) { + return beginDeleteAsync(resourceGroupName, fleetName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName) { + deleteAsync(resourceGroupName, fleetName).block(); + } + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, Context context) { + deleteAsync(resourceGroupName, fleetName, context).block(); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, Long skip, + Long top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, skip, top, skiptoken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, Long skip, + Long top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, skip, top, skiptoken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Long skip, Long top, + String skiptoken) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skip, top, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, skip, top, skiptoken), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, skip, top, skiptoken, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, skip, top, skiptoken)); + } + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, skip, top, skiptoken, context)); + } + + /** + * Gets all fleets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all fleets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Gets all fleets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all fleets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all fleets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all fleets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsImpl.java new file mode 100644 index 000000000000..4ac6bf794d28 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.FleetsClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +import com.azure.resourcemanager.databasefleetmanager.models.Fleets; + +public final class FleetsImpl implements Fleets { + private static final ClientLogger LOGGER = new ClientLogger(FleetsImpl.class); + + private final FleetsClient innerClient; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public FleetsImpl(FleetsClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, fleetName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FleetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Fleet getByResourceGroup(String resourceGroupName, String fleetName) { + FleetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, fleetName); + if (inner != null) { + return new FleetImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String fleetName) { + this.serviceClient().delete(resourceGroupName, fleetName); + } + + public void delete(String resourceGroupName, String fleetName, Context context) { + this.serviceClient().delete(resourceGroupName, fleetName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Long skip, Long top, String skiptoken, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, skip, top, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetImpl(inner1, this.manager())); + } + + public Fleet 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, fleetName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, fleetName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + this.delete(resourceGroupName, fleetName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + this.delete(resourceGroupName, fleetName, context); + } + + private FleetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + public FleetImpl define(String name) { + return new FleetImpl(name, this.manager()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspaceImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspaceImpl.java new file mode 100644 index 000000000000..598e2729b5ce --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspaceImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; + +public final class FleetspaceImpl implements Fleetspace, Fleetspace.Definition, Fleetspace.Update { + private FleetspaceInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public FleetspaceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FleetspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String fleetName; + + private String fleetspaceName; + + public FleetspaceImpl withExistingFleet(String resourceGroupName, String fleetName) { + this.resourceGroupName = resourceGroupName; + this.fleetName = fleetName; + return this; + } + + public Fleetspace create() { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, this.innerModel(), Context.NONE); + return this; + } + + public Fleetspace create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .createOrUpdate(resourceGroupName, fleetName, fleetspaceName, this.innerModel(), context); + return this; + } + + FleetspaceImpl(String name, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = new FleetspaceInner(); + this.serviceManager = serviceManager; + this.fleetspaceName = name; + } + + public FleetspaceImpl update() { + return this; + } + + public Fleetspace apply() { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .update(resourceGroupName, fleetName, fleetspaceName, this.innerModel(), Context.NONE); + return this; + } + + public Fleetspace apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .update(resourceGroupName, fleetName, fleetspaceName, this.innerModel(), context); + return this; + } + + FleetspaceImpl(FleetspaceInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.fleetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleets"); + this.fleetspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "fleetspaces"); + } + + public Fleetspace refresh() { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, Context.NONE) + .getValue(); + return this; + } + + public Fleetspace refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFleetspaces() + .getWithResponse(resourceGroupName, fleetName, fleetspaceName, context) + .getValue(); + return this; + } + + public void registerServer(RegisterServerProperties body) { + serviceManager.fleetspaces().registerServer(resourceGroupName, fleetName, fleetspaceName, body); + } + + public void registerServer(RegisterServerProperties body, Context context) { + serviceManager.fleetspaces().registerServer(resourceGroupName, fleetName, fleetspaceName, body, context); + } + + public void unregister() { + serviceManager.fleetspaces().unregister(resourceGroupName, fleetName, fleetspaceName); + } + + public void unregister(Context context) { + serviceManager.fleetspaces().unregister(resourceGroupName, fleetName, fleetspaceName, context); + } + + public FleetspaceImpl withProperties(FleetspaceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesClientImpl.java new file mode 100644 index 000000000000..a70db01ed81a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesClientImpl.java @@ -0,0 +1,1710 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.databasefleetmanager.fluent.FleetspacesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetspaceListResult; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; +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 FleetspacesClient. + */ +public final class FleetspacesClientImpl implements FleetspacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FleetspacesService service; + + /** + * The service client containing this operation class. + */ + private final DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of FleetspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FleetspacesClientImpl(DatabaseFleetManagerClientImpl client) { + this.service + = RestProxy.create(FleetspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientFleetspaces to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface FleetspacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") FleetspaceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") FleetspaceInner properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}") + @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("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleet(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @QueryParam("$skip") Long skip, @QueryParam("$top") Long top, @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/registerServer") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> registerServer(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RegisterServerProperties body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/unregister") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> unregister(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @PathParam("fleetspaceName") String fleetspaceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByFleetNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, accept, context); + } + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String fleetName, String fleetspaceName) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + Context context) { + return getWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, context).block(); + } + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetspaceInner get(String resourceGroupName, String fleetName, String fleetspaceName) { + return getWithResponse(resourceGroupName, fleetName, fleetspaceName, Context.NONE).getValue(); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, contentType, accept, + resource, context); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetspaceInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetspaceInner.class, FleetspaceInner.class, this.client.getContext()); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetspaceInner> beginCreateOrUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetspaceInner.class, FleetspaceInner.class, context); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetspaceInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource).getSyncPoller(); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetspaceInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource, context) + .getSyncPoller(); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetspaceInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource).block(); + } + + /** + * Creates or updates a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param resource The fleet object to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetspaceInner createOrUpdate(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, fleetspaceName, resource, context).block(); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, FleetspaceInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, contentType, accept, properties, context); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetspaceInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetspaceInner.class, FleetspaceInner.class, this.client.getContext()); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FleetspaceInner> beginUpdateAsync(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FleetspaceInner.class, FleetspaceInner.class, context); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetspaceInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner properties) { + return this.beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, properties).getSyncPoller(); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetspaceInner> beginUpdate(String resourceGroupName, + String fleetName, String fleetspaceName, FleetspaceInner properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, properties, context).getSyncPoller(); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties) { + return beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties, Context context) { + return beginUpdateAsync(resourceGroupName, fleetName, fleetspaceName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetspaceInner update(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties) { + return updateAsync(resourceGroupName, fleetName, fleetspaceName, properties).block(); + } + + /** + * Modifies a fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @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 fleetspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetspaceInner update(String resourceGroupName, String fleetName, String fleetspaceName, + FleetspaceInner properties, Context context) { + return updateAsync(resourceGroupName, fleetName, fleetspaceName, properties, context).block(); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, fleetspaceName, accept, context); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName).getSyncPoller(); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 fleetName, + String fleetspaceName, Context context) { + return this.beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, context).getSyncPoller(); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 fleetName, String fleetspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, fleetName, fleetspaceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName).block(); + } + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fleetName, String fleetspaceName, Context context) { + deleteAsync(resourceGroupName, fleetName, fleetspaceName, context).block(); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetSinglePageAsync(String resourceGroupName, String fleetName, + Long skip, Long top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleet(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, skip, top, skiptoken, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetSinglePageAsync(String resourceGroupName, String fleetName, + Long skip, Long top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByFleet(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, skip, top, skiptoken, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken) { + return new PagedFlux<>(() -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken), + nextLink -> listByFleetNextSinglePageAsync(nextLink)); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedFlux<>(() -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken), + nextLink -> listByFleetNextSinglePageAsync(nextLink)); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByFleetAsync(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedFlux<>( + () -> listByFleetSinglePageAsync(resourceGroupName, fleetName, skip, top, skiptoken, context), + nextLink -> listByFleetNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleet(String resourceGroupName, String fleetName) { + final Long skip = null; + final Long top = null; + final String skiptoken = null; + return new PagedIterable<>(listByFleetAsync(resourceGroupName, fleetName, skip, top, skiptoken)); + } + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + return new PagedIterable<>(listByFleetAsync(resourceGroupName, fleetName, skip, top, skiptoken, context)); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> registerServerWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.registerServer(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, contentType, accept, + body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> registerServerWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.registerServer(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, contentType, accept, body, + context); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRegisterServerAsync(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body) { + Mono>> mono + = registerServerWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRegisterServerAsync(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = registerServerWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginRegisterServer(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body) { + return this.beginRegisterServerAsync(resourceGroupName, fleetName, fleetspaceName, body).getSyncPoller(); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRegisterServer(String resourceGroupName, String fleetName, + String fleetspaceName, RegisterServerProperties body, Context context) { + return this.beginRegisterServerAsync(resourceGroupName, fleetName, fleetspaceName, body, context) + .getSyncPoller(); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 registerServerAsync(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body) { + return beginRegisterServerAsync(resourceGroupName, fleetName, fleetspaceName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono registerServerAsync(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body, Context context) { + return beginRegisterServerAsync(resourceGroupName, fleetName, fleetspaceName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body) { + registerServerAsync(resourceGroupName, fleetName, fleetspaceName, body).block(); + } + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body, Context context) { + registerServerAsync(resourceGroupName, fleetName, fleetspaceName, body, context).block(); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> unregisterWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.unregister(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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>> unregisterWithResponseAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (fleetName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetName is required and cannot be null.")); + } + if (fleetspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter fleetspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.unregister(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, fleetspaceName, accept, context); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginUnregisterAsync(String resourceGroupName, String fleetName, + String fleetspaceName) { + Mono>> mono + = unregisterWithResponseAsync(resourceGroupName, fleetName, fleetspaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginUnregisterAsync(String resourceGroupName, String fleetName, + String fleetspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = unregisterWithResponseAsync(resourceGroupName, fleetName, fleetspaceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginUnregister(String resourceGroupName, String fleetName, + String fleetspaceName) { + return this.beginUnregisterAsync(resourceGroupName, fleetName, fleetspaceName).getSyncPoller(); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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> beginUnregister(String resourceGroupName, String fleetName, + String fleetspaceName, Context context) { + return this.beginUnregisterAsync(resourceGroupName, fleetName, fleetspaceName, context).getSyncPoller(); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 unregisterAsync(String resourceGroupName, String fleetName, String fleetspaceName) { + return beginUnregisterAsync(resourceGroupName, fleetName, fleetspaceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 unregisterAsync(String resourceGroupName, String fleetName, String fleetspaceName, + Context context) { + return beginUnregisterAsync(resourceGroupName, fleetName, fleetspaceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 unregister(String resourceGroupName, String fleetName, String fleetspaceName) { + unregisterAsync(resourceGroupName, fleetName, fleetspaceName).block(); + } + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 unregister(String resourceGroupName, String fleetName, String fleetspaceName, Context context) { + unregisterAsync(resourceGroupName, fleetName, fleetspaceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleetspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByFleetNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleetspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByFleetNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByFleetNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesImpl.java new file mode 100644 index 000000000000..2eee477265b4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/FleetspacesImpl.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.databasefleetmanager.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.databasefleetmanager.fluent.FleetspacesClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspaces; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; + +public final class FleetspacesImpl implements Fleetspaces { + private static final ClientLogger LOGGER = new ClientLogger(FleetspacesImpl.class); + + private final FleetspacesClient innerClient; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public FleetspacesImpl(FleetspacesClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, fleetName, fleetspaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FleetspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Fleetspace get(String resourceGroupName, String fleetName, String fleetspaceName) { + FleetspaceInner inner = this.serviceClient().get(resourceGroupName, fleetName, fleetspaceName); + if (inner != null) { + return new FleetspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName); + } + + public void delete(String resourceGroupName, String fleetName, String fleetspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, fleetName, fleetspaceName, context); + } + + public PagedIterable listByFleet(String resourceGroupName, String fleetName) { + PagedIterable inner = this.serviceClient().listByFleet(resourceGroupName, fleetName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context) { + PagedIterable inner + = this.serviceClient().listByFleet(resourceGroupName, fleetName, skip, top, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetspaceImpl(inner1, this.manager())); + } + + public void registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body) { + this.serviceClient().registerServer(resourceGroupName, fleetName, fleetspaceName, body); + } + + public void registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body, Context context) { + this.serviceClient().registerServer(resourceGroupName, fleetName, fleetspaceName, body, context); + } + + public void unregister(String resourceGroupName, String fleetName, String fleetspaceName) { + this.serviceClient().unregister(resourceGroupName, fleetName, fleetspaceName); + } + + public void unregister(String resourceGroupName, String fleetName, String fleetspaceName, Context context) { + this.serviceClient().unregister(resourceGroupName, fleetName, fleetspaceName, context); + } + + public Fleetspace 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + return this.getWithResponse(resourceGroupName, fleetName, fleetspaceName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, 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 fleetName = ResourceManagerUtils.getValueFromIdByName(id, "fleets"); + if (fleetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleets'.", id))); + } + String fleetspaceName = ResourceManagerUtils.getValueFromIdByName(id, "fleetspaces"); + if (fleetspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'fleetspaces'.", id))); + } + this.delete(resourceGroupName, fleetName, fleetspaceName, context); + } + + private FleetspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } + + public FleetspaceImpl define(String name) { + return new FleetspaceImpl(name, this.manager()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationImpl.java new file mode 100644 index 000000000000..6b5aa492fc39 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.implementation; + +import com.azure.resourcemanager.databasefleetmanager.fluent.models.OperationInner; +import com.azure.resourcemanager.databasefleetmanager.models.ActionType; +import com.azure.resourcemanager.databasefleetmanager.models.Operation; +import com.azure.resourcemanager.databasefleetmanager.models.OperationDisplay; +import com.azure.resourcemanager.databasefleetmanager.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager 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.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationsClientImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..2cf37ab1b909 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.OperationsClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.OperationInner; +import com.azure.resourcemanager.databasefleetmanager.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 DatabaseFleetManagerClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DatabaseFleetManagerClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseFleetManagerClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatabaseFleetManager") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DatabaseFleetManager/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("{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); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationsImpl.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/OperationsImpl.java new file mode 100644 index 000000000000..c629a9af2a7a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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.databasefleetmanager.fluent.OperationsClient; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.OperationInner; +import com.azure.resourcemanager.databasefleetmanager.models.Operation; +import com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager 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.databasefleetmanager.DatabasefleetmanagerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/ResourceManagerUtils.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..18fa0edf0c0f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FirewallRuleListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FirewallRuleListResult.java new file mode 100644 index 000000000000..e11e953d6901 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FirewallRuleListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a FirewallRule list operation. + */ +@Immutable +public final class FirewallRuleListResult implements JsonSerializable { + /* + * The FirewallRule items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FirewallRuleListResult class. + */ + private FirewallRuleListResult() { + } + + /** + * Get the value property: The FirewallRule 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FirewallRuleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleListResult 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 FirewallRuleListResult. + */ + public static FirewallRuleListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleListResult deserializedFirewallRuleListResult = new FirewallRuleListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FirewallRuleInner.fromJson(reader1)); + deserializedFirewallRuleListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFirewallRuleListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleListResult; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetDatabaseListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetDatabaseListResult.java new file mode 100644 index 000000000000..f1550e8ad0a3 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetDatabaseListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetDatabaseInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a FleetDatabase list operation. + */ +@Immutable +public final class FleetDatabaseListResult implements JsonSerializable { + /* + * The FleetDatabase items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FleetDatabaseListResult class. + */ + private FleetDatabaseListResult() { + } + + /** + * Get the value property: The FleetDatabase 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FleetDatabaseListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FleetDatabaseListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetDatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetDatabaseListResult 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 FleetDatabaseListResult. + */ + public static FleetDatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetDatabaseListResult deserializedFleetDatabaseListResult = new FleetDatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FleetDatabaseInner.fromJson(reader1)); + deserializedFleetDatabaseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFleetDatabaseListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetDatabaseListResult; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetListResult.java new file mode 100644 index 000000000000..37933f417336 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Fleet list operation. + */ +@Immutable +public final class FleetListResult implements JsonSerializable { + /* + * The Fleet items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FleetListResult class. + */ + private FleetListResult() { + } + + /** + * Get the value property: The Fleet 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FleetListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FleetListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetListResult 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 FleetListResult. + */ + public static FleetListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetListResult deserializedFleetListResult = new FleetListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FleetInner.fromJson(reader1)); + deserializedFleetListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFleetListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetListResult; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetTierListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetTierListResult.java new file mode 100644 index 000000000000..e7f8d959ae50 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetTierListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a FleetTier list operation. + */ +@Immutable +public final class FleetTierListResult implements JsonSerializable { + /* + * The FleetTier items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FleetTierListResult class. + */ + private FleetTierListResult() { + } + + /** + * Get the value property: The FleetTier 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FleetTierListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FleetTierListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetTierListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetTierListResult 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 FleetTierListResult. + */ + public static FleetTierListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetTierListResult deserializedFleetTierListResult = new FleetTierListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FleetTierInner.fromJson(reader1)); + deserializedFleetTierListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFleetTierListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetTierListResult; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetspaceListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetspaceListResult.java new file mode 100644 index 000000000000..b8aed72048fa --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/FleetspaceListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Fleetspace list operation. + */ +@Immutable +public final class FleetspaceListResult implements JsonSerializable { + /* + * The Fleetspace items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FleetspaceListResult class. + */ + private FleetspaceListResult() { + } + + /** + * Get the value property: The Fleetspace 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FleetspaceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FleetspaceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetspaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetspaceListResult 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 FleetspaceListResult. + */ + public static FleetspaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetspaceListResult deserializedFleetspaceListResult = new FleetspaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FleetspaceInner.fromJson(reader1)); + deserializedFleetspaceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFleetspaceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetspaceListResult; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/OperationListResult.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..1989f7a0cfbc --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/models/OperationListResult.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.databasefleetmanager.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.databasefleetmanager.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/package-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/package-info.java new file mode 100644 index 000000000000..52d7f0a03f6c --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Databasefleetmanager. + * Database Fleet Client. + */ +package com.azure.resourcemanager.databasefleetmanager.implementation; diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ActionType.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ActionType.java new file mode 100644 index 000000000000..b2d0417f2eff --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/AzureProvisioningState.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/AzureProvisioningState.java new file mode 100644 index 000000000000..2ab27319c081 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/AzureProvisioningState.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.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the resource. + */ +public final class AzureProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final AzureProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final AzureProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final AzureProvisioningState CANCELED = fromString("Canceled"); + + /** + * Resource is provisioning. + */ + public static final AzureProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Request on the resource has been accepted. + */ + public static final AzureProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of AzureProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AzureProvisioningState() { + } + + /** + * Creates or finds a AzureProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureProvisioningState. + */ + public static AzureProvisioningState fromString(String name) { + return fromString(name, AzureProvisioningState.class); + } + + /** + * Gets known AzureProvisioningState values. + * + * @return known AzureProvisioningState values. + */ + public static Collection values() { + return values(AzureProvisioningState.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseChangeTierProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseChangeTierProperties.java new file mode 100644 index 000000000000..15551b6f0f11 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseChangeTierProperties.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.databasefleetmanager.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 database change tier definition. + */ +@Fluent +public final class DatabaseChangeTierProperties implements JsonSerializable { + /* + * A target tier name. + */ + private String targetTierName; + + /** + * Creates an instance of DatabaseChangeTierProperties class. + */ + public DatabaseChangeTierProperties() { + } + + /** + * Get the targetTierName property: A target tier name. + * + * @return the targetTierName value. + */ + public String targetTierName() { + return this.targetTierName; + } + + /** + * Set the targetTierName property: A target tier name. + * + * @param targetTierName the targetTierName value to set. + * @return the DatabaseChangeTierProperties object itself. + */ + public DatabaseChangeTierProperties withTargetTierName(String targetTierName) { + this.targetTierName = targetTierName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetTierName", this.targetTierName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseChangeTierProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseChangeTierProperties 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 DatabaseChangeTierProperties. + */ + public static DatabaseChangeTierProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseChangeTierProperties deserializedDatabaseChangeTierProperties = new DatabaseChangeTierProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetTierName".equals(fieldName)) { + deserializedDatabaseChangeTierProperties.targetTierName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseChangeTierProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseCreateMode.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseCreateMode.java new file mode 100644 index 000000000000..62b6c315a37a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseCreateMode.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Create mode. Available options: Default - Create a database. Copy - Copy the source database (source database name + * must be specified) PointInTimeRestore - Create a database by restoring source database from a point in time (source + * database name and restore from time must be specified). + */ +public final class DatabaseCreateMode extends ExpandableStringEnum { + /** + * Create a database. + */ + public static final DatabaseCreateMode DEFAULT = fromString("Default"); + + /** + * Copy the source database (source database name must be specified). + */ + public static final DatabaseCreateMode COPY = fromString("Copy"); + + /** + * Create a database by restoring source database from a point in time (source database name and restore from time + * must be specified). + */ + public static final DatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates a new instance of DatabaseCreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DatabaseCreateMode() { + } + + /** + * Creates or finds a DatabaseCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseCreateMode. + */ + public static DatabaseCreateMode fromString(String name) { + return fromString(name, DatabaseCreateMode.class); + } + + /** + * Gets known DatabaseCreateMode values. + * + * @return known DatabaseCreateMode values. + */ + public static Collection values() { + return values(DatabaseCreateMode.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseIdentity.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseIdentity.java new file mode 100644 index 000000000000..cea71a0137e7 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseIdentity.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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; + +/** + * Database Identity properties. + */ +@Fluent +public final class DatabaseIdentity implements JsonSerializable { + /* + * Resource Id of the database identity. + */ + private String resourceId; + + /* + * Principal Id of the database identity. + */ + private String principalId; + + /* + * Client Id of the database identity. + */ + private String clientId; + + /** + * Creates an instance of DatabaseIdentity class. + */ + public DatabaseIdentity() { + } + + /** + * Get the resourceId property: Resource Id of the database identity. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Resource Id of the database identity. + * + * @param resourceId the resourceId value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the principalId property: Principal Id of the database identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Principal Id of the database identity. + * + * @param principalId the principalId value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the clientId property: Client Id of the database identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client Id of the database identity. + * + * @param clientId the clientId value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("principalId", this.principalId); + jsonWriter.writeStringField("clientId", this.clientId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseIdentity 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 DatabaseIdentity. + */ + public static DatabaseIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseIdentity deserializedDatabaseIdentity = new DatabaseIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedDatabaseIdentity.resourceId = reader.getString(); + } else if ("principalId".equals(fieldName)) { + deserializedDatabaseIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedDatabaseIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseIdentity; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseRenameProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseRenameProperties.java new file mode 100644 index 000000000000..53b56a823df7 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DatabaseRenameProperties.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.databasefleetmanager.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 database rename definition. + */ +@Fluent +public final class DatabaseRenameProperties implements JsonSerializable { + /* + * New database name. + */ + private String newName; + + /** + * Creates an instance of DatabaseRenameProperties class. + */ + public DatabaseRenameProperties() { + } + + /** + * Get the newName property: New database name. + * + * @return the newName value. + */ + public String newName() { + return this.newName; + } + + /** + * Set the newName property: New database name. + * + * @param newName the newName value to set. + * @return the DatabaseRenameProperties object itself. + */ + public DatabaseRenameProperties withNewName(String newName) { + this.newName = newName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("newName", this.newName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseRenameProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseRenameProperties 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 DatabaseRenameProperties. + */ + public static DatabaseRenameProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseRenameProperties deserializedDatabaseRenameProperties = new DatabaseRenameProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("newName".equals(fieldName)) { + deserializedDatabaseRenameProperties.newName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseRenameProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DestinationTierOverride.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DestinationTierOverride.java new file mode 100644 index 000000000000..cf80e9c96d3c --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/DestinationTierOverride.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A destination tier override. + */ +@Fluent +public final class DestinationTierOverride implements JsonSerializable { + /* + * Resource type. + */ + private ResourceType resourceType; + + /* + * Destination tier name. + */ + private String tierName; + + /* + * Resource name. + */ + private String resourceName; + + /** + * Creates an instance of DestinationTierOverride class. + */ + public DestinationTierOverride() { + } + + /** + * Get the resourceType property: Resource type. + * + * @return the resourceType value. + */ + public ResourceType resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Resource type. + * + * @param resourceType the resourceType value to set. + * @return the DestinationTierOverride object itself. + */ + public DestinationTierOverride withResourceType(ResourceType resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the tierName property: Destination tier name. + * + * @return the tierName value. + */ + public String tierName() { + return this.tierName; + } + + /** + * Set the tierName property: Destination tier name. + * + * @param tierName the tierName value to set. + * @return the DestinationTierOverride object itself. + */ + public DestinationTierOverride withTierName(String tierName) { + this.tierName = tierName; + return this; + } + + /** + * Get the resourceName property: Resource name. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Resource name. + * + * @param resourceName the resourceName value to set. + * @return the DestinationTierOverride object itself. + */ + public DestinationTierOverride withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceType in model DestinationTierOverride")); + } + if (tierName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tierName in model DestinationTierOverride")); + } + if (resourceName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceName in model DestinationTierOverride")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DestinationTierOverride.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceType", this.resourceType == null ? null : this.resourceType.toString()); + jsonWriter.writeStringField("tierName", this.tierName); + jsonWriter.writeStringField("resourceName", this.resourceName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DestinationTierOverride from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DestinationTierOverride 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 DestinationTierOverride. + */ + public static DestinationTierOverride fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DestinationTierOverride deserializedDestinationTierOverride = new DestinationTierOverride(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceType".equals(fieldName)) { + deserializedDestinationTierOverride.resourceType = ResourceType.fromString(reader.getString()); + } else if ("tierName".equals(fieldName)) { + deserializedDestinationTierOverride.tierName = reader.getString(); + } else if ("resourceName".equals(fieldName)) { + deserializedDestinationTierOverride.resourceName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDestinationTierOverride; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRule.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRule.java new file mode 100644 index 000000000000..0c64e4c945d6 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRule.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.databasefleetmanager.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; + +/** + * An immutable client-side representation of FirewallRule. + */ +public interface FirewallRule { + /** + * 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: A Firewall rule properties. + * + * @return the properties value. + */ + FirewallRuleProperties 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.databasefleetmanager.fluent.models.FirewallRuleInner object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** + * The entirety of the FirewallRule definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The FirewallRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FirewallRule definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FirewallRule definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, fleetName, fleetspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @return the next definition stage. + */ + WithCreate withExistingFleetspace(String resourceGroupName, String fleetName, String fleetspaceName); + } + + /** + * The stage of the FirewallRule 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. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + + /** + * The stage of the FirewallRule definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Firewall rule properties.. + * + * @param properties A Firewall rule properties. + * @return the next definition stage. + */ + WithCreate withProperties(FirewallRuleProperties properties); + } + } + + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** + * The template for FirewallRule update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + + /** + * The FirewallRule update stages. + */ + interface UpdateStages { + /** + * The stage of the FirewallRule update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Firewall rule properties.. + * + * @param properties A Firewall rule properties. + * @return the next definition stage. + */ + Update withProperties(FirewallRuleProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRuleProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRuleProperties.java new file mode 100644 index 000000000000..d558adeaf44a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRuleProperties.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.databasefleetmanager.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 Firewall rule properties. + */ +@Fluent +public final class FirewallRuleProperties implements JsonSerializable { + /* + * Start IP address. + */ + private String startIpAddress; + + /* + * End IP address. + */ + private String endIpAddress; + + /* + * Provisioning state. + */ + private AzureProvisioningState provisioningState; + + /** + * Creates an instance of FirewallRuleProperties class. + */ + public FirewallRuleProperties() { + } + + /** + * Get the startIpAddress property: Start IP address. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: Start IP address. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: End IP address. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: End IP address. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleProperties object itself. + */ + public FirewallRuleProperties withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public AzureProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startIpAddress", this.startIpAddress); + jsonWriter.writeStringField("endIpAddress", this.endIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleProperties 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 FirewallRuleProperties. + */ + public static FirewallRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleProperties deserializedFirewallRuleProperties = new FirewallRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.startIpAddress = reader.getString(); + } else if ("endIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.endIpAddress = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedFirewallRuleProperties.provisioningState + = AzureProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRules.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRules.java new file mode 100644 index 000000000000..f7037b4e10f3 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FirewallRules.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.databasefleetmanager.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 FirewallRules. + */ +public interface FirewallRules { + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String firewallRuleName, Context context); + + /** + * Gets a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + FirewallRule get(String resourceGroupName, String fleetName, String fleetspaceName, String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String firewallRuleName); + + /** + * Deletes a firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param firewallRuleName Name of the firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String firewallRuleName, + Context context); + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Gets all firewall rules in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all firewall rules in a fleetspace as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, String fleetspaceName, + Long skip, Long top, String skiptoken, Context context); + + /** + * Gets a firewall rule. + * + * @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 firewall rule along with {@link Response}. + */ + FirewallRule getById(String id); + + /** + * Gets a firewall rule. + * + * @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 firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a firewall rule. + * + * @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 FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleet.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleet.java new file mode 100644 index 000000000000..200ff5098344 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleet.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import java.util.Map; + +/** + * An immutable client-side representation of Fleet. + */ +public interface Fleet { + /** + * 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 fleet properties. + * + * @return the properties value. + */ + FleetProperties properties(); + + /** + * 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.databasefleetmanager.fluent.models.FleetInner object. + * + * @return the inner object. + */ + FleetInner innerModel(); + + /** + * The entirety of the Fleet definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Fleet definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Fleet definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Fleet 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 Fleet 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 Fleet 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + Fleet create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Fleet create(Context context); + } + + /** + * The stage of the Fleet 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 Fleet definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The fleet properties.. + * + * @param properties The fleet properties. + * @return the next definition stage. + */ + WithCreate withProperties(FleetProperties properties); + } + } + + /** + * Begins update for the Fleet resource. + * + * @return the stage of resource update. + */ + Fleet.Update update(); + + /** + * The template for Fleet update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Fleet apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Fleet apply(Context context); + } + + /** + * The Fleet update stages. + */ + interface UpdateStages { + /** + * The stage of the Fleet 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 Fleet update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The Database Fleet properties.. + * + * @param properties The Database Fleet properties. + * @return the next definition stage. + */ + Update withProperties(FleetProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Fleet refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Fleet refresh(Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabase.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabase.java new file mode 100644 index 000000000000..e0bf80129471 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabase.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetDatabaseInner; + +/** + * An immutable client-side representation of FleetDatabase. + */ +public interface FleetDatabase { + /** + * 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: Fleet database properties. + * + * @return the properties value. + */ + FleetDatabaseProperties 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.databasefleetmanager.fluent.models.FleetDatabaseInner object. + * + * @return the inner object. + */ + FleetDatabaseInner innerModel(); + + /** + * The entirety of the FleetDatabase definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The FleetDatabase definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FleetDatabase definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FleetDatabase definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, fleetName, fleetspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @return the next definition stage. + */ + WithCreate withExistingFleetspace(String resourceGroupName, String fleetName, String fleetspaceName); + } + + /** + * The stage of the FleetDatabase 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. + */ + FleetDatabase create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FleetDatabase create(Context context); + } + + /** + * The stage of the FleetDatabase definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Fleet database properties.. + * + * @param properties Fleet database properties. + * @return the next definition stage. + */ + WithCreate withProperties(FleetDatabaseProperties properties); + } + } + + /** + * Begins update for the FleetDatabase resource. + * + * @return the stage of resource update. + */ + FleetDatabase.Update update(); + + /** + * The template for FleetDatabase update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FleetDatabase apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FleetDatabase apply(Context context); + } + + /** + * The FleetDatabase update stages. + */ + interface UpdateStages { + /** + * The stage of the FleetDatabase update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Fleet database properties.. + * + * @param properties Fleet database properties. + * @return the next definition stage. + */ + Update withProperties(FleetDatabaseProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FleetDatabase refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FleetDatabase refresh(Context context); + + /** + * Moves database to a different tier. + * + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 changeTier(DatabaseChangeTierProperties body); + + /** + * Moves database to a different tier. + * + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void changeTier(DatabaseChangeTierProperties body, Context context); + + /** + * Renames a database. + * + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 rename(DatabaseRenameProperties body); + + /** + * Renames a database. + * + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rename(DatabaseRenameProperties body, Context context); + + /** + * Revert a database transparent data encryption (TDE). + * + * @throws com.azure.core.management.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 revert(); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revert(Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabaseProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabaseProperties.java new file mode 100644 index 000000000000..579658ec9d90 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabaseProperties.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +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.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; + +/** + * Fleet database properties. + */ +@Fluent +public final class FleetDatabaseProperties implements JsonSerializable { + /* + * Resource identifier for the underlying database resource. + */ + private String originalDatabaseId; + + /* + * Database state. + */ + private AzureProvisioningState provisioningState; + + /* + * Create mode. Available options: Default - Create a database. Copy - Copy the source database (source database + * name must be specified) PointInTimeRestore - Create a database by restoring source database from a point in time + * (source database name and restore from time must be specified) + */ + private DatabaseCreateMode createMode; + + /* + * Name of the tier this database belongs to. + */ + private String tierName; + + /* + * Connection string to connect to the database with. + */ + private String connectionString; + + /* + * If true, database is recoverable. + */ + private Boolean recoverable; + + /* + * Restore from time when CreateMode is PointInTimeRestore. + */ + private OffsetDateTime restoreFromTime; + + /* + * Earliest restore time. + */ + private OffsetDateTime earliestRestoreTime; + + /* + * Latest restore time. + */ + private OffsetDateTime latestRestoreTime; + + /* + * Backup retention in days. + */ + private Integer backupRetentionDays; + + /* + * Maximum database size in Gb. + */ + private Integer databaseSizeGbMax; + + /* + * Source database name used when CreateMode is Copy or PointInTimeRestore. + */ + private String sourceDatabaseName; + + /* + * Additional database properties to be applied as the underlying database resource tags. + */ + private Map resourceTags; + + /* + * Identity property. + */ + private Identity identity; + + /* + * Transparent Data Encryption properties + */ + private TransparentDataEncryption transparentDataEncryption; + + /* + * Database collation. + */ + private String collation; + + /** + * Creates an instance of FleetDatabaseProperties class. + */ + public FleetDatabaseProperties() { + } + + /** + * Get the originalDatabaseId property: Resource identifier for the underlying database resource. + * + * @return the originalDatabaseId value. + */ + public String originalDatabaseId() { + return this.originalDatabaseId; + } + + /** + * Get the provisioningState property: Database state. + * + * @return the provisioningState value. + */ + public AzureProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the createMode property: Create mode. Available options: Default - Create a database. Copy - Copy the source + * database (source database name must be specified) PointInTimeRestore - Create a database by restoring source + * database from a point in time (source database name and restore from time must be specified). + * + * @return the createMode value. + */ + public DatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: Create mode. Available options: Default - Create a database. Copy - Copy the source + * database (source database name must be specified) PointInTimeRestore - Create a database by restoring source + * database from a point in time (source database name and restore from time must be specified). + * + * @param createMode the createMode value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withCreateMode(DatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the tierName property: Name of the tier this database belongs to. + * + * @return the tierName value. + */ + public String tierName() { + return this.tierName; + } + + /** + * Set the tierName property: Name of the tier this database belongs to. + * + * @param tierName the tierName value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withTierName(String tierName) { + this.tierName = tierName; + return this; + } + + /** + * Get the connectionString property: Connection string to connect to the database with. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get the recoverable property: If true, database is recoverable. + * + * @return the recoverable value. + */ + public Boolean recoverable() { + return this.recoverable; + } + + /** + * Get the restoreFromTime property: Restore from time when CreateMode is PointInTimeRestore. + * + * @return the restoreFromTime value. + */ + public OffsetDateTime restoreFromTime() { + return this.restoreFromTime; + } + + /** + * Set the restoreFromTime property: Restore from time when CreateMode is PointInTimeRestore. + * + * @param restoreFromTime the restoreFromTime value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withRestoreFromTime(OffsetDateTime restoreFromTime) { + this.restoreFromTime = restoreFromTime; + return this; + } + + /** + * Get the earliestRestoreTime property: Earliest restore time. + * + * @return the earliestRestoreTime value. + */ + public OffsetDateTime earliestRestoreTime() { + return this.earliestRestoreTime; + } + + /** + * Get the latestRestoreTime property: Latest restore time. + * + * @return the latestRestoreTime value. + */ + public OffsetDateTime latestRestoreTime() { + return this.latestRestoreTime; + } + + /** + * Get the backupRetentionDays property: Backup retention in days. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Get the databaseSizeGbMax property: Maximum database size in Gb. + * + * @return the databaseSizeGbMax value. + */ + public Integer databaseSizeGbMax() { + return this.databaseSizeGbMax; + } + + /** + * Get the sourceDatabaseName property: Source database name used when CreateMode is Copy or PointInTimeRestore. + * + * @return the sourceDatabaseName value. + */ + public String sourceDatabaseName() { + return this.sourceDatabaseName; + } + + /** + * Set the sourceDatabaseName property: Source database name used when CreateMode is Copy or PointInTimeRestore. + * + * @param sourceDatabaseName the sourceDatabaseName value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withSourceDatabaseName(String sourceDatabaseName) { + this.sourceDatabaseName = sourceDatabaseName; + return this; + } + + /** + * Get the resourceTags property: Additional database properties to be applied as the underlying database resource + * tags. + * + * @return the resourceTags value. + */ + public Map resourceTags() { + return this.resourceTags; + } + + /** + * Set the resourceTags property: Additional database properties to be applied as the underlying database resource + * tags. + * + * @param resourceTags the resourceTags value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withResourceTags(Map resourceTags) { + this.resourceTags = resourceTags; + return this; + } + + /** + * Get the identity property: Identity property. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity property. + * + * @param identity the identity value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the transparentDataEncryption property: Transparent Data Encryption properties. + * + * @return the transparentDataEncryption value. + */ + public TransparentDataEncryption transparentDataEncryption() { + return this.transparentDataEncryption; + } + + /** + * Set the transparentDataEncryption property: Transparent Data Encryption properties. + * + * @param transparentDataEncryption the transparentDataEncryption value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withTransparentDataEncryption(TransparentDataEncryption transparentDataEncryption) { + this.transparentDataEncryption = transparentDataEncryption; + return this; + } + + /** + * Get the collation property: Database collation. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Database collation. + * + * @param collation the collation value to set. + * @return the FleetDatabaseProperties object itself. + */ + public FleetDatabaseProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (transparentDataEncryption() != null) { + transparentDataEncryption().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeStringField("tierName", this.tierName); + jsonWriter.writeStringField("restoreFromTime", + this.restoreFromTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.restoreFromTime)); + jsonWriter.writeStringField("sourceDatabaseName", this.sourceDatabaseName); + jsonWriter.writeMapField("resourceTags", this.resourceTags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("transparentDataEncryption", this.transparentDataEncryption); + jsonWriter.writeStringField("collation", this.collation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetDatabaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetDatabaseProperties 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 FleetDatabaseProperties. + */ + public static FleetDatabaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetDatabaseProperties deserializedFleetDatabaseProperties = new FleetDatabaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("originalDatabaseId".equals(fieldName)) { + deserializedFleetDatabaseProperties.originalDatabaseId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedFleetDatabaseProperties.provisioningState + = AzureProvisioningState.fromString(reader.getString()); + } else if ("createMode".equals(fieldName)) { + deserializedFleetDatabaseProperties.createMode = DatabaseCreateMode.fromString(reader.getString()); + } else if ("tierName".equals(fieldName)) { + deserializedFleetDatabaseProperties.tierName = reader.getString(); + } else if ("connectionString".equals(fieldName)) { + deserializedFleetDatabaseProperties.connectionString = reader.getString(); + } else if ("recoverable".equals(fieldName)) { + deserializedFleetDatabaseProperties.recoverable = reader.getNullable(JsonReader::getBoolean); + } else if ("restoreFromTime".equals(fieldName)) { + deserializedFleetDatabaseProperties.restoreFromTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("earliestRestoreTime".equals(fieldName)) { + deserializedFleetDatabaseProperties.earliestRestoreTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("latestRestoreTime".equals(fieldName)) { + deserializedFleetDatabaseProperties.latestRestoreTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("backupRetentionDays".equals(fieldName)) { + deserializedFleetDatabaseProperties.backupRetentionDays = reader.getNullable(JsonReader::getInt); + } else if ("databaseSizeGbMax".equals(fieldName)) { + deserializedFleetDatabaseProperties.databaseSizeGbMax = reader.getNullable(JsonReader::getInt); + } else if ("sourceDatabaseName".equals(fieldName)) { + deserializedFleetDatabaseProperties.sourceDatabaseName = reader.getString(); + } else if ("resourceTags".equals(fieldName)) { + Map resourceTags = reader.readMap(reader1 -> reader1.getString()); + deserializedFleetDatabaseProperties.resourceTags = resourceTags; + } else if ("identity".equals(fieldName)) { + deserializedFleetDatabaseProperties.identity = Identity.fromJson(reader); + } else if ("transparentDataEncryption".equals(fieldName)) { + deserializedFleetDatabaseProperties.transparentDataEncryption + = TransparentDataEncryption.fromJson(reader); + } else if ("collation".equals(fieldName)) { + deserializedFleetDatabaseProperties.collation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetDatabaseProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabases.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabases.java new file mode 100644 index 000000000000..478bd5021908 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetDatabases.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 FleetDatabases. + */ +public interface FleetDatabases { + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + String databaseName, Context context); + + /** + * Gets a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet database. + */ + FleetDatabase get(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String databaseName); + + /** + * Deletes a fleet database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, String databaseName, + Context context); + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Gets all fleet databases in a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param filter An OData filter expression that filters elements in the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleet databases in a fleetspace as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleetspace(String resourceGroupName, String fleetName, String fleetspaceName, + Long skip, Long top, String filter, String skiptoken, Context context); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body); + + /** + * Moves database to a different tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the change tier operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void changeTier(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseChangeTierProperties body, Context context); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body); + + /** + * Renames a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param body The details of the rename operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rename(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + DatabaseRenameProperties body, Context context); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName); + + /** + * Revert a database transparent data encryption (TDE). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param databaseName Name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 revert(String resourceGroupName, String fleetName, String fleetspaceName, String databaseName, + Context context); + + /** + * Gets a fleet database. + * + * @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 fleet database along with {@link Response}. + */ + FleetDatabase getById(String id); + + /** + * Gets a fleet database. + * + * @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 fleet database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a fleet database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a fleet database. + * + * @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 FleetDatabase resource. + * + * @param name resource name. + * @return the first stage of the new FleetDatabase definition. + */ + FleetDatabase.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetProperties.java new file mode 100644 index 000000000000..b7c980c3fd4e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetProperties.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 Database Fleet properties. + */ +@Fluent +public final class FleetProperties implements JsonSerializable { + /* + * Fleet description. + */ + private String description; + + /* + * Provisioning state. + */ + private AzureProvisioningState provisioningState; + + /** + * Creates an instance of FleetProperties class. + */ + public FleetProperties() { + } + + /** + * Get the description property: Fleet description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Fleet description. + * + * @param description the description value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public AzureProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetProperties 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 FleetProperties. + */ + public static FleetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetProperties deserializedFleetProperties = new FleetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedFleetProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedFleetProperties.provisioningState + = AzureProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTier.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTier.java new file mode 100644 index 000000000000..6bee34246999 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTier.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.databasefleetmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; + +/** + * An immutable client-side representation of FleetTier. + */ +public interface FleetTier { + /** + * 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: A Fleet tier properties. + * + * @return the properties value. + */ + FleetTierProperties 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.databasefleetmanager.fluent.models.FleetTierInner object. + * + * @return the inner object. + */ + FleetTierInner innerModel(); + + /** + * The entirety of the FleetTier definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The FleetTier definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FleetTier definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the FleetTier definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, fleetName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @return the next definition stage. + */ + WithCreate withExistingFleet(String resourceGroupName, String fleetName); + } + + /** + * The stage of the FleetTier 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. + */ + FleetTier create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FleetTier create(Context context); + } + + /** + * The stage of the FleetTier definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Fleet tier properties.. + * + * @param properties A Fleet tier properties. + * @return the next definition stage. + */ + WithCreate withProperties(FleetTierProperties properties); + } + } + + /** + * Begins update for the FleetTier resource. + * + * @return the stage of resource update. + */ + FleetTier.Update update(); + + /** + * The template for FleetTier update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FleetTier apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FleetTier apply(Context context); + } + + /** + * The FleetTier update stages. + */ + interface UpdateStages { + /** + * The stage of the FleetTier update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Fleet tier properties.. + * + * @param properties A Fleet tier properties. + * @return the next definition stage. + */ + Update withProperties(FleetTierProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FleetTier refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FleetTier refresh(Context context); + + /** + * Disables a tier. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response}. + */ + Response disableWithResponse(Context context); + + /** + * Disables a tier. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + FleetTier disable(); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTierProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTierProperties.java new file mode 100644 index 000000000000..6da495fb1994 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTierProperties.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 Fleet tier properties. + */ +@Fluent +public final class FleetTierProperties implements JsonSerializable { + /* + * If true, tier is disabled. + */ + private Boolean disabled; + + /* + * If true, serverless resources are provisioned in the tier. + */ + private Boolean serverless; + + /* + * If true, databases are pooled. + */ + private Boolean pooled; + + /* + * Service tier of provisioned resources. Supported values: GeneralPurpose, Hyperscale. + */ + private String serviceTier; + + /* + * Family of provisioned resources, for example Gen5. + */ + private String family; + + /* + * Capacity of provisioned resources in the tier, in units matching the specified service tier, for example vCore + * for GeneralPurpose. + */ + private Integer capacity; + + /* + * Maximum number of databases per pool. + */ + private Integer poolNumOfDatabasesMax; + + /* + * Number of high availability replicas for databases in this tier. + */ + private Integer highAvailabilityReplicaCount; + + /* + * Enable zone redundancy for all databases in this tier. + */ + private ZoneRedundancy zoneRedundancy; + + /* + * Minimum allocated capacity per database, in units matching the specified service tier. + */ + private Double databaseCapacityMin; + + /* + * Maximum allocated capacity per database, in units matching the specified service tier. + */ + private Double databaseCapacityMax; + + /* + * Maximum database size in Gb. + */ + private Integer databaseSizeGbMax; + + /* + * Provisioning state. + */ + private AzureProvisioningState provisioningState; + + /** + * Creates an instance of FleetTierProperties class. + */ + public FleetTierProperties() { + } + + /** + * Get the disabled property: If true, tier is disabled. + * + * @return the disabled value. + */ + public Boolean disabled() { + return this.disabled; + } + + /** + * Get the serverless property: If true, serverless resources are provisioned in the tier. + * + * @return the serverless value. + */ + public Boolean serverless() { + return this.serverless; + } + + /** + * Set the serverless property: If true, serverless resources are provisioned in the tier. + * + * @param serverless the serverless value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withServerless(Boolean serverless) { + this.serverless = serverless; + return this; + } + + /** + * Get the pooled property: If true, databases are pooled. + * + * @return the pooled value. + */ + public Boolean pooled() { + return this.pooled; + } + + /** + * Set the pooled property: If true, databases are pooled. + * + * @param pooled the pooled value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withPooled(Boolean pooled) { + this.pooled = pooled; + return this; + } + + /** + * Get the serviceTier property: Service tier of provisioned resources. Supported values: GeneralPurpose, + * Hyperscale. + * + * @return the serviceTier value. + */ + public String serviceTier() { + return this.serviceTier; + } + + /** + * Set the serviceTier property: Service tier of provisioned resources. Supported values: GeneralPurpose, + * Hyperscale. + * + * @param serviceTier the serviceTier value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withServiceTier(String serviceTier) { + this.serviceTier = serviceTier; + return this; + } + + /** + * Get the family property: Family of provisioned resources, for example Gen5. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: Family of provisioned resources, for example Gen5. + * + * @param family the family value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: Capacity of provisioned resources in the tier, in units matching the specified service + * tier, for example vCore for GeneralPurpose. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Capacity of provisioned resources in the tier, in units matching the specified service + * tier, for example vCore for GeneralPurpose. + * + * @param capacity the capacity value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the poolNumOfDatabasesMax property: Maximum number of databases per pool. + * + * @return the poolNumOfDatabasesMax value. + */ + public Integer poolNumOfDatabasesMax() { + return this.poolNumOfDatabasesMax; + } + + /** + * Set the poolNumOfDatabasesMax property: Maximum number of databases per pool. + * + * @param poolNumOfDatabasesMax the poolNumOfDatabasesMax value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withPoolNumOfDatabasesMax(Integer poolNumOfDatabasesMax) { + this.poolNumOfDatabasesMax = poolNumOfDatabasesMax; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: Number of high availability replicas for databases in this tier. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: Number of high availability replicas for databases in this tier. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Get the zoneRedundancy property: Enable zone redundancy for all databases in this tier. + * + * @return the zoneRedundancy value. + */ + public ZoneRedundancy zoneRedundancy() { + return this.zoneRedundancy; + } + + /** + * Set the zoneRedundancy property: Enable zone redundancy for all databases in this tier. + * + * @param zoneRedundancy the zoneRedundancy value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withZoneRedundancy(ZoneRedundancy zoneRedundancy) { + this.zoneRedundancy = zoneRedundancy; + return this; + } + + /** + * Get the databaseCapacityMin property: Minimum allocated capacity per database, in units matching the specified + * service tier. + * + * @return the databaseCapacityMin value. + */ + public Double databaseCapacityMin() { + return this.databaseCapacityMin; + } + + /** + * Set the databaseCapacityMin property: Minimum allocated capacity per database, in units matching the specified + * service tier. + * + * @param databaseCapacityMin the databaseCapacityMin value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withDatabaseCapacityMin(Double databaseCapacityMin) { + this.databaseCapacityMin = databaseCapacityMin; + return this; + } + + /** + * Get the databaseCapacityMax property: Maximum allocated capacity per database, in units matching the specified + * service tier. + * + * @return the databaseCapacityMax value. + */ + public Double databaseCapacityMax() { + return this.databaseCapacityMax; + } + + /** + * Set the databaseCapacityMax property: Maximum allocated capacity per database, in units matching the specified + * service tier. + * + * @param databaseCapacityMax the databaseCapacityMax value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withDatabaseCapacityMax(Double databaseCapacityMax) { + this.databaseCapacityMax = databaseCapacityMax; + return this; + } + + /** + * Get the databaseSizeGbMax property: Maximum database size in Gb. + * + * @return the databaseSizeGbMax value. + */ + public Integer databaseSizeGbMax() { + return this.databaseSizeGbMax; + } + + /** + * Set the databaseSizeGbMax property: Maximum database size in Gb. + * + * @param databaseSizeGbMax the databaseSizeGbMax value to set. + * @return the FleetTierProperties object itself. + */ + public FleetTierProperties withDatabaseSizeGbMax(Integer databaseSizeGbMax) { + this.databaseSizeGbMax = databaseSizeGbMax; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public AzureProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("serverless", this.serverless); + jsonWriter.writeBooleanField("pooled", this.pooled); + jsonWriter.writeStringField("serviceTier", this.serviceTier); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeNumberField("capacity", this.capacity); + jsonWriter.writeNumberField("poolNumOfDatabasesMax", this.poolNumOfDatabasesMax); + jsonWriter.writeNumberField("highAvailabilityReplicaCount", this.highAvailabilityReplicaCount); + jsonWriter.writeStringField("zoneRedundancy", + this.zoneRedundancy == null ? null : this.zoneRedundancy.toString()); + jsonWriter.writeNumberField("databaseCapacityMin", this.databaseCapacityMin); + jsonWriter.writeNumberField("databaseCapacityMax", this.databaseCapacityMax); + jsonWriter.writeNumberField("databaseSizeGbMax", this.databaseSizeGbMax); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetTierProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetTierProperties 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 FleetTierProperties. + */ + public static FleetTierProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetTierProperties deserializedFleetTierProperties = new FleetTierProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("disabled".equals(fieldName)) { + deserializedFleetTierProperties.disabled = reader.getNullable(JsonReader::getBoolean); + } else if ("serverless".equals(fieldName)) { + deserializedFleetTierProperties.serverless = reader.getNullable(JsonReader::getBoolean); + } else if ("pooled".equals(fieldName)) { + deserializedFleetTierProperties.pooled = reader.getNullable(JsonReader::getBoolean); + } else if ("serviceTier".equals(fieldName)) { + deserializedFleetTierProperties.serviceTier = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedFleetTierProperties.family = reader.getString(); + } else if ("capacity".equals(fieldName)) { + deserializedFleetTierProperties.capacity = reader.getNullable(JsonReader::getInt); + } else if ("poolNumOfDatabasesMax".equals(fieldName)) { + deserializedFleetTierProperties.poolNumOfDatabasesMax = reader.getNullable(JsonReader::getInt); + } else if ("highAvailabilityReplicaCount".equals(fieldName)) { + deserializedFleetTierProperties.highAvailabilityReplicaCount + = reader.getNullable(JsonReader::getInt); + } else if ("zoneRedundancy".equals(fieldName)) { + deserializedFleetTierProperties.zoneRedundancy = ZoneRedundancy.fromString(reader.getString()); + } else if ("databaseCapacityMin".equals(fieldName)) { + deserializedFleetTierProperties.databaseCapacityMin = reader.getNullable(JsonReader::getDouble); + } else if ("databaseCapacityMax".equals(fieldName)) { + deserializedFleetTierProperties.databaseCapacityMax = reader.getNullable(JsonReader::getDouble); + } else if ("databaseSizeGbMax".equals(fieldName)) { + deserializedFleetTierProperties.databaseSizeGbMax = reader.getNullable(JsonReader::getInt); + } else if ("provisioningState".equals(fieldName)) { + deserializedFleetTierProperties.provisioningState + = AzureProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetTierProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTiers.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTiers.java new file mode 100644 index 000000000000..84118eccac07 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetTiers.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 FleetTiers. + */ +public interface FleetTiers { + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String fleetName, String tierName, Context context); + + /** + * Gets a tier resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource. + */ + FleetTier get(String resourceGroupName, String fleetName, String tierName); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String tierName); + + /** + * Deletes a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String tierName, Context context); + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleet(String resourceGroupName, String fleetName); + + /** + * List tiers in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 FleetTier list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context); + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier along with {@link Response}. + */ + Response disableWithResponse(String resourceGroupName, String fleetName, String tierName, + Context context); + + /** + * Disables a tier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param tierName Name of the tier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Database Fleet tier. + */ + FleetTier disable(String resourceGroupName, String fleetName, String tierName); + + /** + * Gets a tier resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response}. + */ + FleetTier getById(String id); + + /** + * Gets a tier resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tier resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a tier. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a tier. + * + * @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 FleetTier resource. + * + * @param name resource name. + * @return the first stage of the new FleetTier definition. + */ + FleetTier.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetUpdate.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetUpdate.java new file mode 100644 index 000000000000..f483f5eda903 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetUpdate.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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; + +/** + * An update to a Database Fleet. + */ +@Fluent +public final class FleetUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The Database Fleet properties. + */ + private FleetProperties properties; + + /** + * Creates an instance of FleetUpdate class. + */ + public FleetUpdate() { + } + + /** + * 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 FleetUpdate object itself. + */ + public FleetUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The Database Fleet properties. + * + * @return the properties value. + */ + public FleetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Database Fleet properties. + * + * @param properties the properties value to set. + * @return the FleetUpdate object itself. + */ + public FleetUpdate withProperties(FleetProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetUpdate 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 FleetUpdate. + */ + public static FleetUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetUpdate deserializedFleetUpdate = new FleetUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedFleetUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedFleetUpdate.properties = FleetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetUpdate; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleets.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleets.java new file mode 100644 index 000000000000..adcd9dedac9a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleets.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 Fleets. + */ +public interface Fleets { + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, Context context); + + /** + * Gets a fleet resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource. + */ + Fleet getByResourceGroup(String resourceGroupName, String fleetName); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName); + + /** + * Deletes a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, Context context); + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all fleets in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Long skip, Long top, String skiptoken, + Context context); + + /** + * Gets all fleets in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all fleets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all fleets in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a fleet resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response}. + */ + Fleet getById(String id); + + /** + * Gets a fleet resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a fleet resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a fleet. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a fleet. + * + * @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 Fleet resource. + * + * @param name resource name. + * @return the first stage of the new Fleet definition. + */ + Fleet.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspace.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspace.java new file mode 100644 index 000000000000..7954dec5ae34 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspace.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; + +/** + * An immutable client-side representation of Fleetspace. + */ +public interface Fleetspace { + /** + * 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: A Fleetspace properties. + * + * @return the properties value. + */ + FleetspaceProperties 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.databasefleetmanager.fluent.models.FleetspaceInner object. + * + * @return the inner object. + */ + FleetspaceInner innerModel(); + + /** + * The entirety of the Fleetspace definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Fleetspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Fleetspace definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Fleetspace definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, fleetName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @return the next definition stage. + */ + WithCreate withExistingFleet(String resourceGroupName, String fleetName); + } + + /** + * The stage of the Fleetspace 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. + */ + Fleetspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Fleetspace create(Context context); + } + + /** + * The stage of the Fleetspace definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Fleetspace properties.. + * + * @param properties A Fleetspace properties. + * @return the next definition stage. + */ + WithCreate withProperties(FleetspaceProperties properties); + } + } + + /** + * Begins update for the Fleetspace resource. + * + * @return the stage of resource update. + */ + Fleetspace.Update update(); + + /** + * The template for Fleetspace update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Fleetspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Fleetspace apply(Context context); + } + + /** + * The Fleetspace update stages. + */ + interface UpdateStages { + /** + * The stage of the Fleetspace update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: A Fleetspace properties.. + * + * @param properties A Fleetspace properties. + * @return the next definition stage. + */ + Update withProperties(FleetspaceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Fleetspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Fleetspace refresh(Context context); + + /** + * Migrates an existing logical server into fleet. + * + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 registerServer(RegisterServerProperties body); + + /** + * Migrates an existing logical server into fleet. + * + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void registerServer(RegisterServerProperties body, Context context); + + /** + * Unregisters all databases from a fleetspace. + * + * @throws com.azure.core.management.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 unregister(); + + /** + * Unregisters all databases from a fleetspace. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 unregister(Context context); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetspaceProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetspaceProperties.java new file mode 100644 index 000000000000..54302035651a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/FleetspaceProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 Fleetspace properties. + */ +@Fluent +public final class FleetspaceProperties implements JsonSerializable { + /* + * Fleetspace state. + */ + private AzureProvisioningState provisioningState; + + /* + * Maximum number of vCores database fleet manager is allowed to provision in the fleetspace. + */ + private Integer capacityMax; + + /* + * Main Microsoft Entra ID principal that has admin access to all databases in the fleetspace. + */ + private MainPrincipal mainPrincipal; + + /** + * Creates an instance of FleetspaceProperties class. + */ + public FleetspaceProperties() { + } + + /** + * Get the provisioningState property: Fleetspace state. + * + * @return the provisioningState value. + */ + public AzureProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the capacityMax property: Maximum number of vCores database fleet manager is allowed to provision in the + * fleetspace. + * + * @return the capacityMax value. + */ + public Integer capacityMax() { + return this.capacityMax; + } + + /** + * Set the capacityMax property: Maximum number of vCores database fleet manager is allowed to provision in the + * fleetspace. + * + * @param capacityMax the capacityMax value to set. + * @return the FleetspaceProperties object itself. + */ + public FleetspaceProperties withCapacityMax(Integer capacityMax) { + this.capacityMax = capacityMax; + return this; + } + + /** + * Get the mainPrincipal property: Main Microsoft Entra ID principal that has admin access to all databases in the + * fleetspace. + * + * @return the mainPrincipal value. + */ + public MainPrincipal mainPrincipal() { + return this.mainPrincipal; + } + + /** + * Set the mainPrincipal property: Main Microsoft Entra ID principal that has admin access to all databases in the + * fleetspace. + * + * @param mainPrincipal the mainPrincipal value to set. + * @return the FleetspaceProperties object itself. + */ + public FleetspaceProperties withMainPrincipal(MainPrincipal mainPrincipal) { + this.mainPrincipal = mainPrincipal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mainPrincipal() != null) { + mainPrincipal().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("capacityMax", this.capacityMax); + jsonWriter.writeJsonField("mainPrincipal", this.mainPrincipal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FleetspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FleetspaceProperties 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 FleetspaceProperties. + */ + public static FleetspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FleetspaceProperties deserializedFleetspaceProperties = new FleetspaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedFleetspaceProperties.provisioningState + = AzureProvisioningState.fromString(reader.getString()); + } else if ("capacityMax".equals(fieldName)) { + deserializedFleetspaceProperties.capacityMax = reader.getNullable(JsonReader::getInt); + } else if ("mainPrincipal".equals(fieldName)) { + deserializedFleetspaceProperties.mainPrincipal = MainPrincipal.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetspaceProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspaces.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspaces.java new file mode 100644 index 000000000000..871c5a3f0bbf --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Fleetspaces.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 Fleetspaces. + */ +public interface Fleetspaces { + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String fleetName, String fleetspaceName, + Context context); + + /** + * Gets fleetspace resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource. + */ + Fleetspace get(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName); + + /** + * Deletes a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 fleetName, String fleetspaceName, Context context); + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleet(String resourceGroupName, String fleetName); + + /** + * Lists fleetspaces in a fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 Fleetspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByFleet(String resourceGroupName, String fleetName, Long skip, Long top, + String skiptoken, Context context); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body); + + /** + * Migrates an existing logical server into fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param body The details of the register server operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void registerServer(String resourceGroupName, String fleetName, String fleetspaceName, + RegisterServerProperties body, Context context); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 unregister(String resourceGroupName, String fleetName, String fleetspaceName); + + /** + * Unregisters all databases from a fleetspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName Name of the database fleet. + * @param fleetspaceName Name of the fleetspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 unregister(String resourceGroupName, String fleetName, String fleetspaceName, Context context); + + /** + * Gets fleetspace resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response}. + */ + Fleetspace getById(String id); + + /** + * Gets fleetspace resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return fleetspace resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a fleetspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a fleetspace. + * + * @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 Fleetspace resource. + * + * @param name resource name. + * @return the first stage of the new Fleetspace definition. + */ + Fleetspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Identity.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Identity.java new file mode 100644 index 000000000000..3dcf65d81898 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Identity.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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; + +/** + * Database Identity. + */ +@Fluent +public final class Identity implements JsonSerializable { + /* + * Identity type of the main principal. + */ + private IdentityType identityType; + + /* + * User identity ids + */ + private List userAssignedIdentities; + + /* + * The federated client id for the SQL Database. It is used for cross tenant CMK scenario. + */ + private String federatedClientId; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * Get the identityType property: Identity type of the main principal. + * + * @return the identityType value. + */ + public IdentityType identityType() { + return this.identityType; + } + + /** + * Set the identityType property: Identity type of the main principal. + * + * @param identityType the identityType value to set. + * @return the Identity object itself. + */ + public Identity withIdentityType(IdentityType identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get the userAssignedIdentities property: User identity ids. + * + * @return the userAssignedIdentities value. + */ + public List userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: User identity ids. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(List userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Get the federatedClientId property: The federated client id for the SQL Database. It is used for cross tenant CMK + * scenario. + * + * @return the federatedClientId value. + */ + public String federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The federated client id for the SQL Database. It is used for cross tenant CMK + * scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the Identity object itself. + */ + public Identity withFederatedClientId(String federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identityType", this.identityType == null ? null : this.identityType.toString()); + jsonWriter.writeArrayField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("federatedClientId", this.federatedClientId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Identity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Identity 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 Identity. + */ + public static Identity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Identity deserializedIdentity = new Identity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identityType".equals(fieldName)) { + deserializedIdentity.identityType = IdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + List userAssignedIdentities + = reader.readArray(reader1 -> DatabaseIdentity.fromJson(reader1)); + deserializedIdentity.userAssignedIdentities = userAssignedIdentities; + } else if ("federatedClientId".equals(fieldName)) { + deserializedIdentity.federatedClientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentity; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/IdentityType.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/IdentityType.java new file mode 100644 index 000000000000..9a467fb91984 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/IdentityType.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.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Identity type of the main principal. + */ +public final class IdentityType extends ExpandableStringEnum { + /** + * No identity. + */ + public static final IdentityType NONE = fromString("None"); + + /** + * User assigned identity. + */ + public static final IdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates a new instance of IdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IdentityType() { + } + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/MainPrincipal.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/MainPrincipal.java new file mode 100644 index 000000000000..bee64fe765ce --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/MainPrincipal.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 main principal. + */ +@Fluent +public final class MainPrincipal implements JsonSerializable { + /* + * Login name of the main principal. + */ + private String login; + + /* + * Application Id of the main principal. + */ + private String applicationId; + + /* + * Object Id of the main principal. + */ + private String objectId; + + /* + * Tenant Id of the main principal. + */ + private String tenantId; + + /* + * Principal type of the main principal. + */ + private PrincipalType principalType; + + /** + * Creates an instance of MainPrincipal class. + */ + public MainPrincipal() { + } + + /** + * Get the login property: Login name of the main principal. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the main principal. + * + * @param login the login value to set. + * @return the MainPrincipal object itself. + */ + public MainPrincipal withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the applicationId property: Application Id of the main principal. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: Application Id of the main principal. + * + * @param applicationId the applicationId value to set. + * @return the MainPrincipal object itself. + */ + public MainPrincipal withApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the objectId property: Object Id of the main principal. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: Object Id of the main principal. + * + * @param objectId the objectId value to set. + * @return the MainPrincipal object itself. + */ + public MainPrincipal withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the tenantId property: Tenant Id of the main principal. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant Id of the main principal. + * + * @param tenantId the tenantId value to set. + * @return the MainPrincipal object itself. + */ + public MainPrincipal withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the principalType property: Principal type of the main principal. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: Principal type of the main principal. + * + * @param principalType the principalType value to set. + * @return the MainPrincipal object itself. + */ + public MainPrincipal withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("login", this.login); + jsonWriter.writeStringField("applicationId", this.applicationId); + jsonWriter.writeStringField("objectId", this.objectId); + jsonWriter.writeStringField("tenantId", this.tenantId); + jsonWriter.writeStringField("principalType", this.principalType == null ? null : this.principalType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MainPrincipal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MainPrincipal 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 MainPrincipal. + */ + public static MainPrincipal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MainPrincipal deserializedMainPrincipal = new MainPrincipal(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("login".equals(fieldName)) { + deserializedMainPrincipal.login = reader.getString(); + } else if ("applicationId".equals(fieldName)) { + deserializedMainPrincipal.applicationId = reader.getString(); + } else if ("objectId".equals(fieldName)) { + deserializedMainPrincipal.objectId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedMainPrincipal.tenantId = reader.getString(); + } else if ("principalType".equals(fieldName)) { + deserializedMainPrincipal.principalType = PrincipalType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMainPrincipal; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Operation.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Operation.java new file mode 100644 index 000000000000..a8c5a9e5d029 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.models; + +import com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/OperationDisplay.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/OperationDisplay.java new file mode 100644 index 000000000000..3c0bffcedd57 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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 and 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Operations.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Operations.java new file mode 100644 index 000000000000..d460646139dc --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Origin.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/Origin.java new file mode 100644 index 000000000000..0ceaaa116428 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/PrincipalType.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/PrincipalType.java new file mode 100644 index 000000000000..0fc8a3c57877 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/PrincipalType.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.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Principal type of the authorized principal. + */ +public final class PrincipalType extends ExpandableStringEnum { + /** + * Application principal type. + */ + public static final PrincipalType APPLICATION = fromString("Application"); + + /** + * User principal type. + */ + public static final PrincipalType USER = fromString("User"); + + /** + * Creates a new instance of PrincipalType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrincipalType() { + } + + /** + * Creates or finds a PrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrincipalType. + */ + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** + * Gets known PrincipalType values. + * + * @return known PrincipalType values. + */ + public static Collection values() { + return values(PrincipalType.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/RegisterServerProperties.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/RegisterServerProperties.java new file mode 100644 index 000000000000..a213af889ac9 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/RegisterServerProperties.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.databasefleetmanager.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; + +/** + * Server registration definition. + */ +@Fluent +public final class RegisterServerProperties implements JsonSerializable { + /* + * Destination tier name. + */ + private String tierName; + + /* + * Source subscription id. + */ + private String sourceSubscriptionId; + + /* + * Source resource group name. + */ + private String sourceResourceGroupName; + + /* + * Source SQL Server name. + */ + private String sourceServerName; + + /* + * Destination tier overrides. + */ + private List destinationTierOverrides; + + /** + * Creates an instance of RegisterServerProperties class. + */ + public RegisterServerProperties() { + } + + /** + * Get the tierName property: Destination tier name. + * + * @return the tierName value. + */ + public String tierName() { + return this.tierName; + } + + /** + * Set the tierName property: Destination tier name. + * + * @param tierName the tierName value to set. + * @return the RegisterServerProperties object itself. + */ + public RegisterServerProperties withTierName(String tierName) { + this.tierName = tierName; + return this; + } + + /** + * Get the sourceSubscriptionId property: Source subscription id. + * + * @return the sourceSubscriptionId value. + */ + public String sourceSubscriptionId() { + return this.sourceSubscriptionId; + } + + /** + * Set the sourceSubscriptionId property: Source subscription id. + * + * @param sourceSubscriptionId the sourceSubscriptionId value to set. + * @return the RegisterServerProperties object itself. + */ + public RegisterServerProperties withSourceSubscriptionId(String sourceSubscriptionId) { + this.sourceSubscriptionId = sourceSubscriptionId; + return this; + } + + /** + * Get the sourceResourceGroupName property: Source resource group name. + * + * @return the sourceResourceGroupName value. + */ + public String sourceResourceGroupName() { + return this.sourceResourceGroupName; + } + + /** + * Set the sourceResourceGroupName property: Source resource group name. + * + * @param sourceResourceGroupName the sourceResourceGroupName value to set. + * @return the RegisterServerProperties object itself. + */ + public RegisterServerProperties withSourceResourceGroupName(String sourceResourceGroupName) { + this.sourceResourceGroupName = sourceResourceGroupName; + return this; + } + + /** + * Get the sourceServerName property: Source SQL Server name. + * + * @return the sourceServerName value. + */ + public String sourceServerName() { + return this.sourceServerName; + } + + /** + * Set the sourceServerName property: Source SQL Server name. + * + * @param sourceServerName the sourceServerName value to set. + * @return the RegisterServerProperties object itself. + */ + public RegisterServerProperties withSourceServerName(String sourceServerName) { + this.sourceServerName = sourceServerName; + return this; + } + + /** + * Get the destinationTierOverrides property: Destination tier overrides. + * + * @return the destinationTierOverrides value. + */ + public List destinationTierOverrides() { + return this.destinationTierOverrides; + } + + /** + * Set the destinationTierOverrides property: Destination tier overrides. + * + * @param destinationTierOverrides the destinationTierOverrides value to set. + * @return the RegisterServerProperties object itself. + */ + public RegisterServerProperties + withDestinationTierOverrides(List destinationTierOverrides) { + this.destinationTierOverrides = destinationTierOverrides; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (destinationTierOverrides() != null) { + destinationTierOverrides().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tierName", this.tierName); + jsonWriter.writeStringField("sourceSubscriptionId", this.sourceSubscriptionId); + jsonWriter.writeStringField("sourceResourceGroupName", this.sourceResourceGroupName); + jsonWriter.writeStringField("sourceServerName", this.sourceServerName); + jsonWriter.writeArrayField("destinationTierOverrides", this.destinationTierOverrides, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegisterServerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegisterServerProperties 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 RegisterServerProperties. + */ + public static RegisterServerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegisterServerProperties deserializedRegisterServerProperties = new RegisterServerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tierName".equals(fieldName)) { + deserializedRegisterServerProperties.tierName = reader.getString(); + } else if ("sourceSubscriptionId".equals(fieldName)) { + deserializedRegisterServerProperties.sourceSubscriptionId = reader.getString(); + } else if ("sourceResourceGroupName".equals(fieldName)) { + deserializedRegisterServerProperties.sourceResourceGroupName = reader.getString(); + } else if ("sourceServerName".equals(fieldName)) { + deserializedRegisterServerProperties.sourceServerName = reader.getString(); + } else if ("destinationTierOverrides".equals(fieldName)) { + List destinationTierOverrides + = reader.readArray(reader1 -> DestinationTierOverride.fromJson(reader1)); + deserializedRegisterServerProperties.destinationTierOverrides = destinationTierOverrides; + } else { + reader.skipChildren(); + } + } + + return deserializedRegisterServerProperties; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ResourceType.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ResourceType.java new file mode 100644 index 000000000000..3c482137e5d4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ResourceType.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.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Resource type of the destination tier override. + */ +public final class ResourceType extends ExpandableStringEnum { + /** + * Database resource type. + */ + public static final ResourceType DATABASE = fromString("Database"); + + /** + * Elastic pool resource type. + */ + public static final ResourceType POOL = fromString("Pool"); + + /** + * Creates a new instance of ResourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceType() { + } + + /** + * Creates or finds a ResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceType. + */ + public static ResourceType fromString(String name) { + return fromString(name, ResourceType.class); + } + + /** + * Gets known ResourceType values. + * + * @return known ResourceType values. + */ + public static Collection values() { + return values(ResourceType.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/TransparentDataEncryption.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/TransparentDataEncryption.java new file mode 100644 index 000000000000..4b6da91bb16a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/TransparentDataEncryption.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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; + +/** + * Transparent Data Encryption properties. + */ +@Fluent +public final class TransparentDataEncryption implements JsonSerializable { + /* + * Customer Managed Key (CMK) Uri. + */ + private String keyUri; + + /* + * Additional Keys + */ + private List keys; + + /* + * Enable key auto rotation + */ + private Boolean enableAutoRotation; + + /** + * Creates an instance of TransparentDataEncryption class. + */ + public TransparentDataEncryption() { + } + + /** + * Get the keyUri property: Customer Managed Key (CMK) Uri. + * + * @return the keyUri value. + */ + public String keyUri() { + return this.keyUri; + } + + /** + * Set the keyUri property: Customer Managed Key (CMK) Uri. + * + * @param keyUri the keyUri value to set. + * @return the TransparentDataEncryption object itself. + */ + public TransparentDataEncryption withKeyUri(String keyUri) { + this.keyUri = keyUri; + return this; + } + + /** + * Get the keys property: Additional Keys. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: Additional Keys. + * + * @param keys the keys value to set. + * @return the TransparentDataEncryption object itself. + */ + public TransparentDataEncryption withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Get the enableAutoRotation property: Enable key auto rotation. + * + * @return the enableAutoRotation value. + */ + public Boolean enableAutoRotation() { + return this.enableAutoRotation; + } + + /** + * Set the enableAutoRotation property: Enable key auto rotation. + * + * @param enableAutoRotation the enableAutoRotation value to set. + * @return the TransparentDataEncryption object itself. + */ + public TransparentDataEncryption withEnableAutoRotation(Boolean enableAutoRotation) { + this.enableAutoRotation = enableAutoRotation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyUri", this.keyUri); + jsonWriter.writeArrayField("keys", this.keys, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("enableAutoRotation", this.enableAutoRotation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransparentDataEncryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransparentDataEncryption 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 TransparentDataEncryption. + */ + public static TransparentDataEncryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransparentDataEncryption deserializedTransparentDataEncryption = new TransparentDataEncryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyUri".equals(fieldName)) { + deserializedTransparentDataEncryption.keyUri = reader.getString(); + } else if ("keys".equals(fieldName)) { + List keys = reader.readArray(reader1 -> reader1.getString()); + deserializedTransparentDataEncryption.keys = keys; + } else if ("enableAutoRotation".equals(fieldName)) { + deserializedTransparentDataEncryption.enableAutoRotation + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedTransparentDataEncryption; + }); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ZoneRedundancy.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ZoneRedundancy.java new file mode 100644 index 000000000000..bafed9dc2982 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/ZoneRedundancy.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.databasefleetmanager.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of zone redundancy in a tier. + */ +public final class ZoneRedundancy extends ExpandableStringEnum { + /** + * Zone redundancy enabled. + */ + public static final ZoneRedundancy ENABLED = fromString("Enabled"); + + /** + * Zone redundancy disabled. + */ + public static final ZoneRedundancy DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of ZoneRedundancy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ZoneRedundancy() { + } + + /** + * Creates or finds a ZoneRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ZoneRedundancy. + */ + public static ZoneRedundancy fromString(String name) { + return fromString(name, ZoneRedundancy.class); + } + + /** + * Gets known ZoneRedundancy values. + * + * @return known ZoneRedundancy values. + */ + public static Collection values() { + return values(ZoneRedundancy.class); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/package-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/package-info.java new file mode 100644 index 000000000000..409553c5f5fb --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Databasefleetmanager. + * Database Fleet Client. + */ +package com.azure.resourcemanager.databasefleetmanager.models; diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/package-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/package-info.java new file mode 100644 index 000000000000..ac9deffa8945 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/com/azure/resourcemanager/databasefleetmanager/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Databasefleetmanager. + * Database Fleet Client. + */ +package com.azure.resourcemanager.databasefleetmanager; diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/module-info.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/java/module-info.java new file mode 100644 index 000000000000..9a1906395338 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/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.databasefleetmanager { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.databasefleetmanager; + exports com.azure.resourcemanager.databasefleetmanager.fluent; + exports com.azure.resourcemanager.databasefleetmanager.fluent.models; + exports com.azure.resourcemanager.databasefleetmanager.models; + + opens com.azure.resourcemanager.databasefleetmanager.fluent.models to com.azure.core; + opens com.azure.resourcemanager.databasefleetmanager.models to com.azure.core; + opens com.azure.resourcemanager.databasefleetmanager.implementation.models to com.azure.core; +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/proxy-config.json b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/proxy-config.json new file mode 100644 index 000000000000..e438065bc0ce --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.databasefleetmanager.implementation.FirewallRulesClientImpl$FirewallRulesService"],["com.azure.resourcemanager.databasefleetmanager.implementation.FleetDatabasesClientImpl$FleetDatabasesService"],["com.azure.resourcemanager.databasefleetmanager.implementation.FleetTiersClientImpl$FleetTiersService"],["com.azure.resourcemanager.databasefleetmanager.implementation.FleetsClientImpl$FleetsService"],["com.azure.resourcemanager.databasefleetmanager.implementation.FleetspacesClientImpl$FleetspacesService"],["com.azure.resourcemanager.databasefleetmanager.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/reflect-config.json b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-databasefleetmanager/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/azure-resourcemanager-databasefleetmanager.properties b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/azure-resourcemanager-databasefleetmanager.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/main/resources/azure-resourcemanager-databasefleetmanager.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..46e75cf01bee --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; + +/** + * Samples for FirewallRules CreateOrUpdate. + */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .define("allow-10-0-0-0-24-to-10-1-0-0-24") + .withExistingFleetspace("rg-networking-operations", "data-fleet-01", "prod-environment") + .withProperties(new FirewallRuleProperties().withStartIpAddress("10.0.0.0").withEndIpAddress("10.0.0.255")) + .create(); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesDeleteSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 000000000000..ff85738b0c93 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesDeleteSamples.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.databasefleetmanager.generated; + +/** + * Samples for FirewallRules Delete. + */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Delete Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void deleteFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .delete("rg-networking-operations", "data-fleet-01", "prod-environment", "allow-10-0-0-0-24-to-10-1-0-0-24", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetSamples.java new file mode 100644 index 000000000000..a1dec7905096 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetSamples.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.databasefleetmanager.generated; + +/** + * Samples for FirewallRules Get. + */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Get Firewall Rule - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void getFirewallRuleGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .getWithResponse("rg-networking-operations", "data-fleet-01", "prod-environment", + "allow-10-0-0-0-24-to-10-1-0-0-24", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceSamples.java new file mode 100644 index 000000000000..614f10919e6f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceSamples.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.databasefleetmanager.generated; + +/** + * Samples for FirewallRules ListByFleetspace. + */ +public final class FirewallRulesListByFleetspaceSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FirewallRules_ListByFleetspace_MaximumSet_Gen.json + */ + /** + * Sample code: List Firewall Rules by Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void listFirewallRulesByFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.firewallRules() + .listByFleetspace("rg-networking-operations", "data-fleet-01", "prod-environment", 8L, 18L, + "thjchalxuwykrawwdgaie", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesChangeTierSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesChangeTierSamples.java new file mode 100644 index 000000000000..4fd080edaba2 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesChangeTierSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; + +/** + * Samples for FleetDatabases ChangeTier. + */ +public final class FleetDatabasesChangeTierSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_ChangeTier_MaximumSet_Gen.json + */ + /** + * Sample code: Change Database Tier - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void changeDatabaseTierGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .changeTier("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + new DatabaseChangeTierProperties().withTargetTierName("Standard"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesCreateOrUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d3df233b5e85 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesCreateOrUpdateSamples.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseCreateMode; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabaseProperties; +import com.azure.resourcemanager.databasefleetmanager.models.Identity; +import com.azure.resourcemanager.databasefleetmanager.models.IdentityType; +import com.azure.resourcemanager.databasefleetmanager.models.TransparentDataEncryption; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FleetDatabases CreateOrUpdate. + */ +public final class FleetDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Database in Fleet - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateDatabaseInFleetGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .define("customer-db-prod") + .withExistingFleetspace("rg-database-operations", "data-fleet-01", "prod-environment") + .withProperties(new FleetDatabaseProperties().withCreateMode(DatabaseCreateMode.DEFAULT) + .withTierName("Premium") + .withRestoreFromTime(OffsetDateTime.parse("2024-11-06T09:16:05.048Z")) + .withSourceDatabaseName("existing-db-prod") + .withResourceTags(mapOf("project", "Customer Data")) + .withIdentity(new Identity().withIdentityType(IdentityType.NONE) + .withUserAssignedIdentities(Arrays.asList(new DatabaseIdentity().withResourceId( + "/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01") + .withPrincipalId("a2b3c4d5-6789-0123-4567-89abcdef1234") + .withClientId("a2b3c4d5-6789-0123-4567-89abcdef1234"))) + .withFederatedClientId("a2b3c4d5-6789-0123-4567-89abcdef1234")) + .withTransparentDataEncryption(new TransparentDataEncryption().withKeyUri("fakeTokenPlaceholder") + .withKeys(Arrays.asList("key1")) + .withEnableAutoRotation(true))) + .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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesDeleteSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesDeleteSamples.java new file mode 100644 index 000000000000..30be280b83c7 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesDeleteSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetDatabases Delete. + */ +public final class FleetDatabasesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: FleetDatabases_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetDatabasesDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .delete("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesGetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesGetSamples.java new file mode 100644 index 000000000000..6f94f44e9008 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesGetSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetDatabases Get. + */ +public final class FleetDatabasesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Retrieve Database Details in Fleet - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void retrieveDatabaseDetailsInFleetGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .getWithResponse("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesListByFleetspaceSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesListByFleetspaceSamples.java new file mode 100644 index 000000000000..78b4892a046b --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesListByFleetspaceSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetDatabases ListByFleetspace. + */ +public final class FleetDatabasesListByFleetspaceSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_ListByFleetspace_MaximumSet_Gen.json + */ + /** + * Sample code: List Databases in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void listDatabasesInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .listByFleetspace("rg-database-operations", "data-fleet-01", "prod-environment", 24L, 2L, + "tier eq 'Premium'", "sbrskcoueja", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRenameSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRenameSamples.java new file mode 100644 index 000000000000..ec54f12d2065 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRenameSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; + +/** + * Samples for FleetDatabases Rename. + */ +public final class FleetDatabasesRenameSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Rename_MaximumSet_Gen.json + */ + /** + * Sample code: Rename Database in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void renameDatabaseInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .rename("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + new DatabaseRenameProperties().withNewName("new-customer-db-prod"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRevertSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRevertSamples.java new file mode 100644 index 000000000000..32dd31c6e4a8 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesRevertSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetDatabases Revert. + */ +public final class FleetDatabasesRevertSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Revert_MaximumSet_Gen.json + */ + /** + * Sample code: Revert Transparent Data Encryption in Database - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void revertTransparentDataEncryptionInDatabaseGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetDatabases() + .revert("rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesUpdateSamples.java new file mode 100644 index 000000000000..a90f01b381bd --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetDatabasesUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseCreateMode; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabase; +import com.azure.resourcemanager.databasefleetmanager.models.FleetDatabaseProperties; +import com.azure.resourcemanager.databasefleetmanager.models.Identity; +import com.azure.resourcemanager.databasefleetmanager.models.IdentityType; +import com.azure.resourcemanager.databasefleetmanager.models.TransparentDataEncryption; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FleetDatabases Update. + */ +public final class FleetDatabasesUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetDatabases_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Update Database in Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void updateDatabaseInFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + FleetDatabase resource = manager.fleetDatabases() + .getWithResponse("rgdatabasefleetmanager", "production-fleet", "primary-space", "customer-database-prod", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetDatabaseProperties().withCreateMode(DatabaseCreateMode.DEFAULT) + .withTierName("Standard") + .withRestoreFromTime(OffsetDateTime.parse("2024-11-06T09:16:05.048Z")) + .withSourceDatabaseName("customer-database-staging") + .withResourceTags(mapOf("environment", "production", "owner", "database-team")) + .withIdentity(new Identity().withIdentityType(IdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(Arrays.asList(new DatabaseIdentity().withResourceId( + "/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourcegroups/rgdatabasefleetmanager/providers/Microsoft.ManagedIdentity/userAssignedIdentities/db-identity") + .withPrincipalId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withClientId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"))) + .withFederatedClientId("a2b3c4d5-6789-0123-4567-89abcdef1234")) + .withTransparentDataEncryption(new TransparentDataEncryption().withKeyUri("fakeTokenPlaceholder") + .withKeys(Arrays.asList("abc123", "xyz789")) + .withEnableAutoRotation(true))) + .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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f96a63420c1f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; + +/** + * Samples for FleetTiers CreateOrUpdate. + */ +public final class FleetTiersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_CreateOrUpdate_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .define("general-purpose-tier") + .withExistingFleet("rg-database-fleet-manager", "critical-production-fleet") + .withProperties(new FleetTierProperties().withServerless(false) + .withPooled(true) + .withServiceTier("GeneralPurpose") + .withFamily("Gen5") + .withCapacity(4) + .withPoolNumOfDatabasesMax(10) + .withHighAvailabilityReplicaCount(5) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(0.0D) + .withDatabaseCapacityMax(4.0D) + .withDatabaseSizeGbMax(50)) + .create(); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDeleteSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDeleteSamples.java new file mode 100644 index 000000000000..9fa912dee89d --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDeleteSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetTiers Delete. + */ +public final class FleetTiersDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .delete("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableSamples.java new file mode 100644 index 000000000000..ac7c0056befc --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetTiers Disable. + */ +public final class FleetTiersDisableSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Disable_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Disable_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersDisableMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .disableWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetSamples.java new file mode 100644 index 000000000000..747f30f98aac --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetTiers Get. + */ +public final class FleetTiersGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .getWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetSamples.java new file mode 100644 index 000000000000..f008acfc62ef --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetSamples.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.databasefleetmanager.generated; + +/** + * Samples for FleetTiers ListByFleet. + */ +public final class FleetTiersListByFleetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_ListByFleet_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_ListByFleet_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersListByFleetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetTiers() + .listByFleet("rg-database-fleet-manager", "critical-production-fleet", 10L, 1L, "hfrg", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersUpdateSamples.java new file mode 100644 index 000000000000..74335266effc --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; + +/** + * Samples for FleetTiers Update. + */ +public final class FleetTiersUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/FleetTiers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: FleetTiers_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetTiersUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + FleetTier resource = manager.fleetTiers() + .getWithResponse("rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetTierProperties().withServerless(false) + .withPooled(true) + .withServiceTier("GeneralPurpose") + .withFamily("Gen5") + .withCapacity(4) + .withPoolNumOfDatabasesMax(10) + .withHighAvailabilityReplicaCount(5) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(0.0D) + .withDatabaseCapacityMax(4.0D) + .withDatabaseSizeGbMax(50)) + .apply(); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..08f29b951cf8 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets CreateOrUpdate. + */ +public final class FleetsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_CreateOrUpdate_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsCreateOrUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .define("production-fleet-01") + .withRegion("East US") + .withExistingResourceGroup("rg-database-fleet-manager") + .withTags(mapOf("environment", "production", "owner", "team-database")) + .withProperties( + new FleetProperties().withDescription("Production fleet for high availability and scalability.")) + .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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsDeleteSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsDeleteSamples.java new file mode 100644 index 000000000000..029a008ffd29 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsDeleteSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleets Delete. + */ +public final class FleetsDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets().delete("rg-database-fleet-manager", "production-fleet-01", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..5527d3071007 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleets GetByResourceGroup. + */ +public final class FleetsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .getByResourceGroupWithResponse("rg-database-fleet-manager", "production-fleet-01", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupSamples.java new file mode 100644 index 000000000000..c297cd536b0f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleets ListByResourceGroup. + */ +public final class FleetsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_ListByResourceGroup_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsListByResourceGroupMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets() + .listByResourceGroup("rg-database-fleet-manager", 6L, 30L, "ovlavzakdncfvvbdhqkal", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListSamples.java new file mode 100644 index 000000000000..779813886c23 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleets List. + */ +public final class FleetsListSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_List_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleets().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsUpdateSamples.java new file mode 100644 index 000000000000..0ac8d53b0781 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets Update. + */ +public final class FleetsUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Fleets_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetsUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + Fleet resource = manager.fleets() + .getByResourceGroupWithResponse("rg-database-fleet-manager", "critical-production-fleet", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("environment", "production", "owner", "team-database")) + .withProperties(new FleetProperties().withDescription( + "Fleet containing critical production databases and high availability configurations.")) + .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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..76eb3c82a8f9 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; + +/** + * Samples for Fleetspaces CreateOrUpdate. + */ +public final class FleetspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Create or Update Fleetspace - Generated by Policy. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void createOrUpdateFleetspaceGeneratedByPolicy( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .define("primary-space") + .withExistingFleet("rgdatabasefleetmanager", "production-fleet") + .withProperties(new FleetspaceProperties().withCapacityMax(150000) + .withMainPrincipal(new MainPrincipal().withLogin("adminUser") + .withApplicationId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39") + .withObjectId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withTenantId("bde45d44-ec42-45b8-a5a2-c5b998c65ef6") + .withPrincipalType(PrincipalType.APPLICATION))) + .create(); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesDeleteSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesDeleteSamples.java new file mode 100644 index 000000000000..34879e4e1601 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesDeleteSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleetspaces Delete. + */ +public final class FleetspacesDeleteSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Delete_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesDeleteMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .delete("rgdatabasefleetmanager", "production-fleet", "primary-space", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetSamples.java new file mode 100644 index 000000000000..1832957b8320 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleetspaces Get. + */ +public final class FleetspacesGetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Get_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesGetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .getWithResponse("rgdatabasefleetmanager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetSamples.java new file mode 100644 index 000000000000..0a273f164f25 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleetspaces ListByFleet. + */ +public final class FleetspacesListByFleetSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_ListByFleet_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_ListByFleet_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesListByFleetMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .listByFleet("rg-database-fleet-manager", "production-fleet", 27L, 7L, "qaorjlbhvuntmn", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesRegisterServerSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesRegisterServerSamples.java new file mode 100644 index 000000000000..7e38612cf7e4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesRegisterServerSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.DestinationTierOverride; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ResourceType; +import java.util.Arrays; + +/** + * Samples for Fleetspaces RegisterServer. + */ +public final class FleetspacesRegisterServerSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_RegisterServer_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_RegisterServer_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesRegisterServerMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .registerServer("rg-database-fleet-manager", "production-fleet", "primary-space", + new RegisterServerProperties().withTierName("Standard") + .withSourceSubscriptionId("c76e2b32-46c7-4325-8f4f-476828a5b207") + .withSourceResourceGroupName("rg-source-database") + .withSourceServerName("source-db-server-prod") + .withDestinationTierOverrides( + Arrays.asList(new DestinationTierOverride().withResourceType(ResourceType.DATABASE) + .withTierName("bronze") + .withResourceName("source-db-prod"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUnregisterSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUnregisterSamples.java new file mode 100644 index 000000000000..476e5d3af99d --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUnregisterSamples.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.databasefleetmanager.generated; + +/** + * Samples for Fleetspaces Unregister. + */ +public final class FleetspacesUnregisterSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Unregister_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Unregister_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesUnregisterMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.fleetspaces() + .unregister("rg-database-fleet-manager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUpdateSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUpdateSamples.java new file mode 100644 index 000000000000..a96493dc09ca --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesUpdateSamples.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.databasefleetmanager.generated; + +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; + +/** + * Samples for Fleetspaces Update. + */ +public final class FleetspacesUpdateSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Fleetspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Fleetspaces_Update_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void fleetspacesUpdateMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + Fleetspace resource = manager.fleetspaces() + .getWithResponse("rg-database-fleet-manager", "production-fleet", "primary-space", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new FleetspaceProperties().withCapacityMax(150000) + .withMainPrincipal(new MainPrincipal().withLogin("adminUser") + .withApplicationId("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39") + .withObjectId("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92") + .withTenantId("bde45d44-ec42-45b8-a5a2-c5b998c65ef6") + .withPrincipalType(PrincipalType.APPLICATION))) + .apply(); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationsListSamples.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationsListSamples.java new file mode 100644 index 000000000000..c3e8b272a07c --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/samples/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to DatabasefleetmanagerManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.databasefleetmanager.DatabasefleetmanagerManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseChangeTierPropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseChangeTierPropertiesTests.java new file mode 100644 index 000000000000..b69573db0f99 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseChangeTierPropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseChangeTierProperties; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseChangeTierPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseChangeTierProperties model = BinaryData.fromString("{\"targetTierName\":\"spwgcuertumkdosv\"}") + .toObject(DatabaseChangeTierProperties.class); + Assertions.assertEquals("spwgcuertumkdosv", model.targetTierName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseChangeTierProperties model = new DatabaseChangeTierProperties().withTargetTierName("spwgcuertumkdosv"); + model = BinaryData.fromObject(model).toObject(DatabaseChangeTierProperties.class); + Assertions.assertEquals("spwgcuertumkdosv", model.targetTierName()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseIdentityTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseIdentityTests.java new file mode 100644 index 000000000000..df69df3829c4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseIdentityTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseIdentity model = BinaryData + .fromString("{\"resourceId\":\"appd\",\"principalId\":\"dkvwrwjfe\",\"clientId\":\"nhutjeltmrldhugj\"}") + .toObject(DatabaseIdentity.class); + Assertions.assertEquals("appd", model.resourceId()); + Assertions.assertEquals("dkvwrwjfe", model.principalId()); + Assertions.assertEquals("nhutjeltmrldhugj", model.clientId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseIdentity model = new DatabaseIdentity().withResourceId("appd") + .withPrincipalId("dkvwrwjfe") + .withClientId("nhutjeltmrldhugj"); + model = BinaryData.fromObject(model).toObject(DatabaseIdentity.class); + Assertions.assertEquals("appd", model.resourceId()); + Assertions.assertEquals("dkvwrwjfe", model.principalId()); + Assertions.assertEquals("nhutjeltmrldhugj", model.clientId()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseRenamePropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseRenamePropertiesTests.java new file mode 100644 index 000000000000..82c51a3657e6 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DatabaseRenamePropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseRenameProperties; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseRenamePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseRenameProperties model + = BinaryData.fromString("{\"newName\":\"hbmdgbbjfdd\"}").toObject(DatabaseRenameProperties.class); + Assertions.assertEquals("hbmdgbbjfdd", model.newName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseRenameProperties model = new DatabaseRenameProperties().withNewName("hbmdgbbjfdd"); + model = BinaryData.fromObject(model).toObject(DatabaseRenameProperties.class); + Assertions.assertEquals("hbmdgbbjfdd", model.newName()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DestinationTierOverrideTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DestinationTierOverrideTests.java new file mode 100644 index 000000000000..807f7084da9a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/DestinationTierOverrideTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DestinationTierOverride; +import com.azure.resourcemanager.databasefleetmanager.models.ResourceType; +import org.junit.jupiter.api.Assertions; + +public final class DestinationTierOverrideTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DestinationTierOverride model = BinaryData + .fromString("{\"resourceType\":\"Pool\",\"tierName\":\"lwhijcoejctbzaq\",\"resourceName\":\"qsycbkbfkgu\"}") + .toObject(DestinationTierOverride.class); + Assertions.assertEquals(ResourceType.POOL, model.resourceType()); + Assertions.assertEquals("lwhijcoejctbzaq", model.tierName()); + Assertions.assertEquals("qsycbkbfkgu", model.resourceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DestinationTierOverride model = new DestinationTierOverride().withResourceType(ResourceType.POOL) + .withTierName("lwhijcoejctbzaq") + .withResourceName("qsycbkbfkgu"); + model = BinaryData.fromObject(model).toObject(DestinationTierOverride.class); + Assertions.assertEquals(ResourceType.POOL, model.resourceType()); + Assertions.assertEquals("lwhijcoejctbzaq", model.tierName()); + Assertions.assertEquals("qsycbkbfkgu", model.resourceName()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleInnerTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleInnerTests.java new file mode 100644 index 000000000000..7cc1ed6a4493 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleInnerTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRuleInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleInner model = BinaryData.fromString( + "{\"properties\":{\"startIpAddress\":\"vkwlzuvccfwnf\",\"endIpAddress\":\"acfi\",\"provisioningState\":\"Canceled\"},\"id\":\"bxetqgtzxdpn\",\"name\":\"bqqwxrj\",\"type\":\"eallnwsubisnj\"}") + .toObject(FirewallRuleInner.class); + Assertions.assertEquals("vkwlzuvccfwnf", model.properties().startIpAddress()); + Assertions.assertEquals("acfi", model.properties().endIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FirewallRuleInner model = new FirewallRuleInner() + .withProperties(new FirewallRuleProperties().withStartIpAddress("vkwlzuvccfwnf").withEndIpAddress("acfi")); + model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); + Assertions.assertEquals("vkwlzuvccfwnf", model.properties().startIpAddress()); + Assertions.assertEquals("acfi", model.properties().endIpAddress()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleListResultTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleListResultTests.java new file mode 100644 index 000000000000..2d9349f20c31 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRuleListResultTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FirewallRuleListResult; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRuleListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"startIpAddress\":\"bonqvpkvlrxnjeas\",\"endIpAddress\":\"pheoflokeyy\",\"provisioningState\":\"Failed\"},\"id\":\"bdlwtgrhpdjpj\",\"name\":\"masxazjpqyegu\",\"type\":\"lhbxxhejjzzvdud\"},{\"properties\":{\"startIpAddress\":\"slfhotwm\",\"endIpAddress\":\"npwlbjnpg\",\"provisioningState\":\"Accepted\"},\"id\":\"adehxnltyfsopp\",\"name\":\"suesnzw\",\"type\":\"ej\"},{\"properties\":{\"startIpAddress\":\"orxzdmohctbqvud\",\"endIpAddress\":\"dndnvow\",\"provisioningState\":\"Accepted\"},\"id\":\"ugw\",\"name\":\"kcglhslaz\",\"type\":\"dyggdtjixhbku\"},{\"properties\":{\"startIpAddress\":\"wey\",\"endIpAddress\":\"menevfyexfwh\",\"provisioningState\":\"Canceled\"},\"id\":\"bvyvdcsity\",\"name\":\"naamde\",\"type\":\"tehfiqscjeypvh\"}],\"nextLink\":\"rkgqhcjrefo\"}") + .toObject(FirewallRuleListResult.class); + Assertions.assertEquals("bonqvpkvlrxnjeas", model.value().get(0).properties().startIpAddress()); + Assertions.assertEquals("pheoflokeyy", model.value().get(0).properties().endIpAddress()); + Assertions.assertEquals("rkgqhcjrefo", model.nextLink()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulePropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulePropertiesTests.java new file mode 100644 index 000000000000..89c3f341af45 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRulePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleProperties model = BinaryData + .fromString("{\"startIpAddress\":\"pmng\",\"endIpAddress\":\"scxaq\",\"provisioningState\":\"Failed\"}") + .toObject(FirewallRuleProperties.class); + Assertions.assertEquals("pmng", model.startIpAddress()); + Assertions.assertEquals("scxaq", model.endIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FirewallRuleProperties model + = new FirewallRuleProperties().withStartIpAddress("pmng").withEndIpAddress("scxaq"); + model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); + Assertions.assertEquals("pmng", model.startIpAddress()); + Assertions.assertEquals("scxaq", model.endIpAddress()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..060edce26506 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesCreateOrUpdateMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRule; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRuleProperties; +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 FirewallRulesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"startIpAddress\":\"lylpstdb\",\"endIpAddress\":\"xsrz\",\"provisioningState\":\"Succeeded\"},\"id\":\"erscdntne\",\"name\":\"fiwjmygtdssls\",\"type\":\"tmweriofzpyq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FirewallRule response = manager.firewallRules() + .define("lqlfm") + .withExistingFleetspace("vhqlkthumaqo", "bgycduiertgccym", "aolps") + .withProperties( + new FirewallRuleProperties().withStartIpAddress("bbglzpswiydmc").withEndIpAddress("hzdxssadbzm")) + .create(); + + Assertions.assertEquals("lylpstdb", response.properties().startIpAddress()); + Assertions.assertEquals("xsrz", response.properties().endIpAddress()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetWithResponseMockTests.java new file mode 100644 index 000000000000..dc120c5d7824 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesGetWithResponseMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRule; +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 FirewallRulesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"startIpAddress\":\"k\",\"endIpAddress\":\"mpew\",\"provisioningState\":\"Provisioning\"},\"id\":\"krvrns\",\"name\":\"shqjohxcrsbf\",\"type\":\"vasrruvwb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FirewallRule response = manager.firewallRules() + .getWithResponse("ivetvtcq", "qtdo", "mcbxvwvxysl", "bhsfxob", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("k", response.properties().startIpAddress()); + Assertions.assertEquals("mpew", response.properties().endIpAddress()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceMockTests.java new file mode 100644 index 000000000000..0ed5f5c665f4 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FirewallRulesListByFleetspaceMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FirewallRule; +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 FirewallRulesListByFleetspaceMockTests { + @Test + public void testListByFleetspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"startIpAddress\":\"taruoujmkcj\",\"endIpAddress\":\"qytjrybnwjewgd\",\"provisioningState\":\"Canceled\"},\"id\":\"vnaenqpehindoyg\",\"name\":\"ifthnz\",\"type\":\"ndslgnayqigynduh\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.firewallRules() + .listByFleetspace("sqfsubcgjbirxb", "ybsrfbjfdtwss", "t", 9027138809470227979L, 3313980915890942939L, + "zbexilzznfqqnvw", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("taruoujmkcj", response.iterator().next().properties().startIpAddress()); + Assertions.assertEquals("qytjrybnwjewgd", response.iterator().next().properties().endIpAddress()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetInnerTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetInnerTests.java new file mode 100644 index 000000000000..a55496145fb2 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetInnerTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FleetInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetInner model = BinaryData.fromString( + "{\"properties\":{\"description\":\"exxppofmxaxcfjp\",\"provisioningState\":\"Canceled\"},\"location\":\"ocjjxhvpmouexh\",\"tags\":{\"qeojnxqbzvddntw\":\"i\",\"vuhrhcffcyddgl\":\"deicbtwnpzao\",\"xmqci\":\"jthjqkwpyei\"},\"id\":\"q\",\"name\":\"hkh\",\"type\":\"xuigdtopbobj\"}") + .toObject(FleetInner.class); + Assertions.assertEquals("ocjjxhvpmouexh", model.location()); + Assertions.assertEquals("i", model.tags().get("qeojnxqbzvddntw")); + Assertions.assertEquals("exxppofmxaxcfjp", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetInner model = new FleetInner().withLocation("ocjjxhvpmouexh") + .withTags(mapOf("qeojnxqbzvddntw", "i", "vuhrhcffcyddgl", "deicbtwnpzao", "xmqci", "jthjqkwpyei")) + .withProperties(new FleetProperties().withDescription("exxppofmxaxcfjp")); + model = BinaryData.fromObject(model).toObject(FleetInner.class); + Assertions.assertEquals("ocjjxhvpmouexh", model.location()); + Assertions.assertEquals("i", model.tags().get("qeojnxqbzvddntw")); + Assertions.assertEquals("exxppofmxaxcfjp", model.properties().description()); + } + + // 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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetListResultTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetListResultTests.java new file mode 100644 index 000000000000..b62cdd4b627a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetListResultTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetListResult; +import org.junit.jupiter.api.Assertions; + +public final class FleetListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"description\":\"nxkrx\",\"provisioningState\":\"Failed\"},\"location\":\"dt\",\"tags\":{\"hjybigehoqfbo\":\"rvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\"},\"id\":\"nhzgpphrcgyn\",\"name\":\"ocpecfvmmco\",\"type\":\"fsxlzevgbmqjqa\"}],\"nextLink\":\"y\"}") + .toObject(FleetListResult.class); + Assertions.assertEquals("dt", model.value().get(0).location()); + Assertions.assertEquals("rvqdra", model.value().get(0).tags().get("hjybigehoqfbo")); + Assertions.assertEquals("nxkrx", model.value().get(0).properties().description()); + Assertions.assertEquals("y", model.nextLink()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetPropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetPropertiesTests.java new file mode 100644 index 000000000000..c4034c9e050e --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetPropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import org.junit.jupiter.api.Assertions; + +public final class FleetPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetProperties model = BinaryData.fromString("{\"description\":\"hm\",\"provisioningState\":\"Failed\"}") + .toObject(FleetProperties.class); + Assertions.assertEquals("hm", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetProperties model = new FleetProperties().withDescription("hm"); + model = BinaryData.fromObject(model).toObject(FleetProperties.class); + Assertions.assertEquals("hm", model.description()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierInnerTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierInnerTests.java new file mode 100644 index 000000000000..6c8a7f06802a --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierInnerTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetTierInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +import org.junit.jupiter.api.Assertions; + +public final class FleetTierInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetTierInner model = BinaryData.fromString( + "{\"properties\":{\"disabled\":true,\"serverless\":false,\"pooled\":true,\"serviceTier\":\"yvxyqjp\",\"family\":\"attpngjcrcczsq\",\"capacity\":1452431495,\"poolNumOfDatabasesMax\":1112494803,\"highAvailabilityReplicaCount\":747144042,\"zoneRedundancy\":\"Enabled\",\"databaseCapacityMin\":23.812542535217762,\"databaseCapacityMax\":57.931778810567735,\"databaseSizeGbMax\":104525492,\"provisioningState\":\"Provisioning\"},\"id\":\"oaeupfhyhltrpmo\",\"name\":\"jmcmatuokthfu\",\"type\":\"uaodsfcpk\"}") + .toObject(FleetTierInner.class); + Assertions.assertEquals(false, model.properties().serverless()); + Assertions.assertEquals(true, model.properties().pooled()); + Assertions.assertEquals("yvxyqjp", model.properties().serviceTier()); + Assertions.assertEquals("attpngjcrcczsq", model.properties().family()); + Assertions.assertEquals(1452431495, model.properties().capacity()); + Assertions.assertEquals(1112494803, model.properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(747144042, model.properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.ENABLED, model.properties().zoneRedundancy()); + Assertions.assertEquals(23.812542535217762D, model.properties().databaseCapacityMin()); + Assertions.assertEquals(57.931778810567735D, model.properties().databaseCapacityMax()); + Assertions.assertEquals(104525492, model.properties().databaseSizeGbMax()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetTierInner model = new FleetTierInner().withProperties(new FleetTierProperties().withServerless(false) + .withPooled(true) + .withServiceTier("yvxyqjp") + .withFamily("attpngjcrcczsq") + .withCapacity(1452431495) + .withPoolNumOfDatabasesMax(1112494803) + .withHighAvailabilityReplicaCount(747144042) + .withZoneRedundancy(ZoneRedundancy.ENABLED) + .withDatabaseCapacityMin(23.812542535217762D) + .withDatabaseCapacityMax(57.931778810567735D) + .withDatabaseSizeGbMax(104525492)); + model = BinaryData.fromObject(model).toObject(FleetTierInner.class); + Assertions.assertEquals(false, model.properties().serverless()); + Assertions.assertEquals(true, model.properties().pooled()); + Assertions.assertEquals("yvxyqjp", model.properties().serviceTier()); + Assertions.assertEquals("attpngjcrcczsq", model.properties().family()); + Assertions.assertEquals(1452431495, model.properties().capacity()); + Assertions.assertEquals(1112494803, model.properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(747144042, model.properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.ENABLED, model.properties().zoneRedundancy()); + Assertions.assertEquals(23.812542535217762D, model.properties().databaseCapacityMin()); + Assertions.assertEquals(57.931778810567735D, model.properties().databaseCapacityMax()); + Assertions.assertEquals(104525492, model.properties().databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierListResultTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierListResultTests.java new file mode 100644 index 000000000000..5666ac386707 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierListResultTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetTierListResult; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +import org.junit.jupiter.api.Assertions; + +public final class FleetTierListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetTierListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"disabled\":false,\"serverless\":true,\"pooled\":true,\"serviceTier\":\"stkiiuxhqyud\",\"family\":\"rrqnbpoczvyifqrv\",\"capacity\":983918139,\"poolNumOfDatabasesMax\":1045892554,\"highAvailabilityReplicaCount\":838682594,\"zoneRedundancy\":\"Enabled\",\"databaseCapacityMin\":50.73262308079136,\"databaseCapacityMax\":76.00537139753739,\"databaseSizeGbMax\":1829419035,\"provisioningState\":\"Failed\"},\"id\":\"ulexxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"},{\"properties\":{\"disabled\":true,\"serverless\":true,\"pooled\":true,\"serviceTier\":\"flbvvnchrkcciwwz\",\"family\":\"qkhr\",\"capacity\":1877680716,\"poolNumOfDatabasesMax\":1410521625,\"highAvailabilityReplicaCount\":481973669,\"zoneRedundancy\":\"Disabled\",\"databaseCapacityMin\":64.6060319017848,\"databaseCapacityMax\":83.38773455931201,\"databaseSizeGbMax\":1515601233,\"provisioningState\":\"Succeeded\"},\"id\":\"jmvxie\",\"name\":\"uugidyjrrfby\",\"type\":\"osvexcsonpclhoc\"}],\"nextLink\":\"slkevle\"}") + .toObject(FleetTierListResult.class); + Assertions.assertEquals(true, model.value().get(0).properties().serverless()); + Assertions.assertEquals(true, model.value().get(0).properties().pooled()); + Assertions.assertEquals("stkiiuxhqyud", model.value().get(0).properties().serviceTier()); + Assertions.assertEquals("rrqnbpoczvyifqrv", model.value().get(0).properties().family()); + Assertions.assertEquals(983918139, model.value().get(0).properties().capacity()); + Assertions.assertEquals(1045892554, model.value().get(0).properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(838682594, model.value().get(0).properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.ENABLED, model.value().get(0).properties().zoneRedundancy()); + Assertions.assertEquals(50.73262308079136D, model.value().get(0).properties().databaseCapacityMin()); + Assertions.assertEquals(76.00537139753739D, model.value().get(0).properties().databaseCapacityMax()); + Assertions.assertEquals(1829419035, model.value().get(0).properties().databaseSizeGbMax()); + Assertions.assertEquals("slkevle", model.nextLink()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierPropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierPropertiesTests.java new file mode 100644 index 000000000000..0c0983366397 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTierPropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +import org.junit.jupiter.api.Assertions; + +public final class FleetTierPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetTierProperties model = BinaryData.fromString( + "{\"disabled\":true,\"serverless\":true,\"pooled\":true,\"serviceTier\":\"myzydagfuaxbez\",\"family\":\"uokktwhrdxwz\",\"capacity\":180468800,\"poolNumOfDatabasesMax\":436585772,\"highAvailabilityReplicaCount\":1170430043,\"zoneRedundancy\":\"Disabled\",\"databaseCapacityMin\":17.70073898875807,\"databaseCapacityMax\":0.6073530909555869,\"databaseSizeGbMax\":1010959661,\"provisioningState\":\"Succeeded\"}") + .toObject(FleetTierProperties.class); + Assertions.assertEquals(true, model.serverless()); + Assertions.assertEquals(true, model.pooled()); + Assertions.assertEquals("myzydagfuaxbez", model.serviceTier()); + Assertions.assertEquals("uokktwhrdxwz", model.family()); + Assertions.assertEquals(180468800, model.capacity()); + Assertions.assertEquals(436585772, model.poolNumOfDatabasesMax()); + Assertions.assertEquals(1170430043, model.highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.DISABLED, model.zoneRedundancy()); + Assertions.assertEquals(17.70073898875807D, model.databaseCapacityMin()); + Assertions.assertEquals(0.6073530909555869D, model.databaseCapacityMax()); + Assertions.assertEquals(1010959661, model.databaseSizeGbMax()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetTierProperties model = new FleetTierProperties().withServerless(true) + .withPooled(true) + .withServiceTier("myzydagfuaxbez") + .withFamily("uokktwhrdxwz") + .withCapacity(180468800) + .withPoolNumOfDatabasesMax(436585772) + .withHighAvailabilityReplicaCount(1170430043) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(17.70073898875807D) + .withDatabaseCapacityMax(0.6073530909555869D) + .withDatabaseSizeGbMax(1010959661); + model = BinaryData.fromObject(model).toObject(FleetTierProperties.class); + Assertions.assertEquals(true, model.serverless()); + Assertions.assertEquals(true, model.pooled()); + Assertions.assertEquals("myzydagfuaxbez", model.serviceTier()); + Assertions.assertEquals("uokktwhrdxwz", model.family()); + Assertions.assertEquals(180468800, model.capacity()); + Assertions.assertEquals(436585772, model.poolNumOfDatabasesMax()); + Assertions.assertEquals(1170430043, model.highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.DISABLED, model.zoneRedundancy()); + Assertions.assertEquals(17.70073898875807D, model.databaseCapacityMin()); + Assertions.assertEquals(0.6073530909555869D, model.databaseCapacityMax()); + Assertions.assertEquals(1010959661, model.databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..730d4e4f1a38 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersCreateOrUpdateMockTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTierProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +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 FleetTiersCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"disabled\":true,\"serverless\":true,\"pooled\":true,\"serviceTier\":\"taakc\",\"family\":\"iyzvqtmnub\",\"capacity\":908407782,\"poolNumOfDatabasesMax\":1989438546,\"highAvailabilityReplicaCount\":1254452597,\"zoneRedundancy\":\"Enabled\",\"databaseCapacityMin\":20.0417737626587,\"databaseCapacityMax\":73.46157561550241,\"databaseSizeGbMax\":1083170526,\"provisioningState\":\"Succeeded\"},\"id\":\"mg\",\"name\":\"opkwhojv\",\"type\":\"ajqgxy\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FleetTier response = manager.fleetTiers() + .define("pkeqdcvdrhvoo") + .withExistingFleet("apnedgfbcvkc", "q") + .withProperties(new FleetTierProperties().withServerless(true) + .withPooled(true) + .withServiceTier("opcjwvnhd") + .withFamily("wmgxcxrsl") + .withCapacity(1073132708) + .withPoolNumOfDatabasesMax(2107317095) + .withHighAvailabilityReplicaCount(306696017) + .withZoneRedundancy(ZoneRedundancy.DISABLED) + .withDatabaseCapacityMin(42.563397154526115D) + .withDatabaseCapacityMax(8.13951448981184D) + .withDatabaseSizeGbMax(726839595)) + .create(); + + Assertions.assertEquals(true, response.properties().serverless()); + Assertions.assertEquals(true, response.properties().pooled()); + Assertions.assertEquals("taakc", response.properties().serviceTier()); + Assertions.assertEquals("iyzvqtmnub", response.properties().family()); + Assertions.assertEquals(908407782, response.properties().capacity()); + Assertions.assertEquals(1989438546, response.properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(1254452597, response.properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.ENABLED, response.properties().zoneRedundancy()); + Assertions.assertEquals(20.0417737626587D, response.properties().databaseCapacityMin()); + Assertions.assertEquals(73.46157561550241D, response.properties().databaseCapacityMax()); + Assertions.assertEquals(1083170526, response.properties().databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableWithResponseMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableWithResponseMockTests.java new file mode 100644 index 000000000000..0e4804e8d375 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersDisableWithResponseMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +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 FleetTiersDisableWithResponseMockTests { + @Test + public void testDisableWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"disabled\":false,\"serverless\":false,\"pooled\":false,\"serviceTier\":\"thhqzonosggbh\",\"family\":\"hfwdsjnkaljutiis\",\"capacity\":559440936,\"poolNumOfDatabasesMax\":1975902978,\"highAvailabilityReplicaCount\":2043531661,\"zoneRedundancy\":\"Disabled\",\"databaseCapacityMin\":65.27270342322805,\"databaseCapacityMax\":26.544754948691327,\"databaseSizeGbMax\":1769895546,\"provisioningState\":\"Provisioning\"},\"id\":\"ilvpnppfuflrwd\",\"name\":\"hdlxyjrxsagafcn\",\"type\":\"hgw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FleetTier response = manager.fleetTiers() + .disableWithResponse("el", "phsdyhto", "fikdowwqu", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(false, response.properties().serverless()); + Assertions.assertEquals(false, response.properties().pooled()); + Assertions.assertEquals("thhqzonosggbh", response.properties().serviceTier()); + Assertions.assertEquals("hfwdsjnkaljutiis", response.properties().family()); + Assertions.assertEquals(559440936, response.properties().capacity()); + Assertions.assertEquals(1975902978, response.properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(2043531661, response.properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.DISABLED, response.properties().zoneRedundancy()); + Assertions.assertEquals(65.27270342322805D, response.properties().databaseCapacityMin()); + Assertions.assertEquals(26.544754948691327D, response.properties().databaseCapacityMax()); + Assertions.assertEquals(1769895546, response.properties().databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetWithResponseMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetWithResponseMockTests.java new file mode 100644 index 000000000000..fb02929c2d20 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersGetWithResponseMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +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 FleetTiersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"disabled\":false,\"serverless\":true,\"pooled\":true,\"serviceTier\":\"wmbesldnkw\",\"family\":\"pp\",\"capacity\":1133358626,\"poolNumOfDatabasesMax\":1710257464,\"highAvailabilityReplicaCount\":1319718925,\"zoneRedundancy\":\"Disabled\",\"databaseCapacityMin\":13.610535199896724,\"databaseCapacityMax\":0.5053473740073366,\"databaseSizeGbMax\":696489313,\"provisioningState\":\"Failed\"},\"id\":\"kqze\",\"name\":\"qkdltfz\",\"type\":\"mhhv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + FleetTier response = manager.fleetTiers() + .getWithResponse("emwabnet", "hhszh", "d", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(true, response.properties().serverless()); + Assertions.assertEquals(true, response.properties().pooled()); + Assertions.assertEquals("wmbesldnkw", response.properties().serviceTier()); + Assertions.assertEquals("pp", response.properties().family()); + Assertions.assertEquals(1133358626, response.properties().capacity()); + Assertions.assertEquals(1710257464, response.properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(1319718925, response.properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.DISABLED, response.properties().zoneRedundancy()); + Assertions.assertEquals(13.610535199896724D, response.properties().databaseCapacityMin()); + Assertions.assertEquals(0.5053473740073366D, response.properties().databaseCapacityMax()); + Assertions.assertEquals(696489313, response.properties().databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetMockTests.java new file mode 100644 index 000000000000..da15166c6868 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetTiersListByFleetMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.FleetTier; +import com.azure.resourcemanager.databasefleetmanager.models.ZoneRedundancy; +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 FleetTiersListByFleetMockTests { + @Test + public void testListByFleet() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"disabled\":false,\"serverless\":true,\"pooled\":false,\"serviceTier\":\"kbebxmubyyntwlrb\",\"family\":\"koievseo\",\"capacity\":143823433,\"poolNumOfDatabasesMax\":209864806,\"highAvailabilityReplicaCount\":407342571,\"zoneRedundancy\":\"Enabled\",\"databaseCapacityMin\":93.94025609740328,\"databaseCapacityMax\":94.56387544596132,\"databaseSizeGbMax\":566352608,\"provisioningState\":\"Provisioning\"},\"id\":\"pgcjefuzmuvp\",\"name\":\"ttdumorppxebmnzb\",\"type\":\"bhjpglkfgohdne\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.fleetTiers() + .listByFleet("gureodkwobdag", "tibqdxbxwakb", 8763143854800145717L, 1852847846506171698L, "dlkzgxhuri", + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(true, response.iterator().next().properties().serverless()); + Assertions.assertEquals(false, response.iterator().next().properties().pooled()); + Assertions.assertEquals("kbebxmubyyntwlrb", response.iterator().next().properties().serviceTier()); + Assertions.assertEquals("koievseo", response.iterator().next().properties().family()); + Assertions.assertEquals(143823433, response.iterator().next().properties().capacity()); + Assertions.assertEquals(209864806, response.iterator().next().properties().poolNumOfDatabasesMax()); + Assertions.assertEquals(407342571, response.iterator().next().properties().highAvailabilityReplicaCount()); + Assertions.assertEquals(ZoneRedundancy.ENABLED, response.iterator().next().properties().zoneRedundancy()); + Assertions.assertEquals(93.94025609740328D, response.iterator().next().properties().databaseCapacityMin()); + Assertions.assertEquals(94.56387544596132D, response.iterator().next().properties().databaseCapacityMax()); + Assertions.assertEquals(566352608, response.iterator().next().properties().databaseSizeGbMax()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetUpdateTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetUpdateTests.java new file mode 100644 index 000000000000..4db458d176c2 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetUpdateTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import com.azure.resourcemanager.databasefleetmanager.models.FleetUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FleetUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetUpdate model = BinaryData.fromString( + "{\"tags\":{\"hrzayvvtpgvdf\":\"a\"},\"properties\":{\"description\":\"tkftutqxlngx\",\"provisioningState\":\"Failed\"}}") + .toObject(FleetUpdate.class); + Assertions.assertEquals("a", model.tags().get("hrzayvvtpgvdf")); + Assertions.assertEquals("tkftutqxlngx", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetUpdate model = new FleetUpdate().withTags(mapOf("hrzayvvtpgvdf", "a")) + .withProperties(new FleetProperties().withDescription("tkftutqxlngx")); + model = BinaryData.fromObject(model).toObject(FleetUpdate.class); + Assertions.assertEquals("a", model.tags().get("hrzayvvtpgvdf")); + Assertions.assertEquals("tkftutqxlngx", model.properties().description()); + } + + // 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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..66d351b77340 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsCreateOrUpdateMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +import com.azure.resourcemanager.databasefleetmanager.models.FleetProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FleetsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"cfbu\",\"provisioningState\":\"Succeeded\"},\"location\":\"qjhhkxbpv\",\"tags\":{\"u\":\"jhxxjyn\"},\"id\":\"ivkrtsw\",\"name\":\"xqzvszjfa\",\"type\":\"vjfdx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Fleet response = manager.fleets() + .define("yaqcslyjpkiidz") + .withRegion("nalaulppg") + .withExistingResourceGroup("xyawj") + .withTags(mapOf("igvpgylg", "pnapnyiropuh", "medjvcslynqwwncw", "git", "pkteo", "zhxgktrmgucn", + "pfqbuaceopzf", "llwptfdy")) + .withProperties(new FleetProperties().withDescription("znelixhnrztfolh")) + .create(); + + Assertions.assertEquals("qjhhkxbpv", response.location()); + Assertions.assertEquals("jhxxjyn", response.tags().get("u")); + Assertions.assertEquals("cfbu", response.properties().description()); + } + + // 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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupWithResponseMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..b199e21b738b --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsGetByResourceGroupWithResponseMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +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 FleetsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"zbtd\",\"provisioningState\":\"Succeeded\"},\"location\":\"znbmpowuwprzq\",\"tags\":{\"xobbcswsrt\":\"ualupjmkh\",\"fgb\":\"riplrbpbewtg\",\"wxzvlvqhjkb\":\"c\"},\"id\":\"gibtnm\",\"name\":\"iebwwaloayqcgwrt\",\"type\":\"j\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Fleet response = manager.fleets() + .getByResourceGroupWithResponse("bkpyc", "klwndnhjdauwhv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("znbmpowuwprzq", response.location()); + Assertions.assertEquals("ualupjmkh", response.tags().get("xobbcswsrt")); + Assertions.assertEquals("zbtd", response.properties().description()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..01a64901344f --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListByResourceGroupMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +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 FleetsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"description\":\"savjcbpwxqps\",\"provisioningState\":\"Provisioning\"},\"location\":\"tguvriuhp\",\"tags\":{\"oyq\":\"dyvxqtayriww\",\"mefqsgzvahapjyzh\":\"exrmcqibycnojvk\",\"zlmwlxkvugfhz\":\"vgqzcjrvxd\"},\"id\":\"vawjvzunlu\",\"name\":\"hnnpr\",\"type\":\"xipeilpjzuaejx\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.fleets() + .listByResourceGroup("zg", 2493734222555395016L, 7617156723683268552L, "txon", + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tguvriuhp", response.iterator().next().location()); + Assertions.assertEquals("dyvxqtayriww", response.iterator().next().tags().get("oyq")); + Assertions.assertEquals("savjcbpwxqps", response.iterator().next().properties().description()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListMockTests.java new file mode 100644 index 000000000000..d3f6d78e77f2 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetsListMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleet; +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 FleetsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"description\":\"tskzbbtdzumveek\",\"provisioningState\":\"Provisioning\"},\"location\":\"zuhkfpbsjyof\",\"tags\":{\"oekqvk\":\"uusdttouwa\"},\"id\":\"lns\",\"name\":\"vbxwyjsflhh\",\"type\":\"aalnjixi\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.fleets().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("zuhkfpbsjyof", response.iterator().next().location()); + Assertions.assertEquals("uusdttouwa", response.iterator().next().tags().get("oekqvk")); + Assertions.assertEquals("tskzbbtdzumveek", response.iterator().next().properties().description()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceInnerTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceInnerTests.java new file mode 100644 index 000000000000..e6e38317eba9 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceInnerTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.fluent.models.FleetspaceInner; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +import org.junit.jupiter.api.Assertions; + +public final class FleetspaceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetspaceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"capacityMax\":432312766,\"mainPrincipal\":{\"login\":\"pbhtqqrolfpfpsa\",\"applicationId\":\"bquxigjy\",\"objectId\":\"zjaoyfhrtxil\",\"tenantId\":\"rkujy\",\"principalType\":\"Application\"}},\"id\":\"juvf\",\"name\":\"awrlyx\",\"type\":\"jkcpr\"}") + .toObject(FleetspaceInner.class); + Assertions.assertEquals(432312766, model.properties().capacityMax()); + Assertions.assertEquals("pbhtqqrolfpfpsa", model.properties().mainPrincipal().login()); + Assertions.assertEquals("bquxigjy", model.properties().mainPrincipal().applicationId()); + Assertions.assertEquals("zjaoyfhrtxil", model.properties().mainPrincipal().objectId()); + Assertions.assertEquals("rkujy", model.properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.properties().mainPrincipal().principalType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetspaceInner model + = new FleetspaceInner().withProperties(new FleetspaceProperties().withCapacityMax(432312766) + .withMainPrincipal(new MainPrincipal().withLogin("pbhtqqrolfpfpsa") + .withApplicationId("bquxigjy") + .withObjectId("zjaoyfhrtxil") + .withTenantId("rkujy") + .withPrincipalType(PrincipalType.APPLICATION))); + model = BinaryData.fromObject(model).toObject(FleetspaceInner.class); + Assertions.assertEquals(432312766, model.properties().capacityMax()); + Assertions.assertEquals("pbhtqqrolfpfpsa", model.properties().mainPrincipal().login()); + Assertions.assertEquals("bquxigjy", model.properties().mainPrincipal().applicationId()); + Assertions.assertEquals("zjaoyfhrtxil", model.properties().mainPrincipal().objectId()); + Assertions.assertEquals("rkujy", model.properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.properties().mainPrincipal().principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceListResultTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceListResultTests.java new file mode 100644 index 000000000000..bd43143ebabf --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspaceListResultTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.implementation.models.FleetspaceListResult; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +import org.junit.jupiter.api.Assertions; + +public final class FleetspaceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetspaceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"capacityMax\":1833473049,\"mainPrincipal\":{\"login\":\"fsrpymzidnse\",\"applicationId\":\"xtbzsgfyccsne\",\"objectId\":\"dwzjeiach\",\"tenantId\":\"osfln\",\"principalType\":\"User\"}},\"id\":\"qpteeh\",\"name\":\"zvypyqrimzinp\",\"type\":\"swjdkirso\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"capacityMax\":1455872330,\"mainPrincipal\":{\"login\":\"nohjt\",\"applicationId\":\"whdsoifiyip\",\"objectId\":\"sqwpgrjb\",\"tenantId\":\"orcjxvsnby\",\"principalType\":\"User\"}},\"id\":\"nmoc\",\"name\":\"cyshurzafbljjgp\",\"type\":\"toqcjmklja\"}],\"nextLink\":\"qidtqajzyu\"}") + .toObject(FleetspaceListResult.class); + Assertions.assertEquals(1833473049, model.value().get(0).properties().capacityMax()); + Assertions.assertEquals("fsrpymzidnse", model.value().get(0).properties().mainPrincipal().login()); + Assertions.assertEquals("xtbzsgfyccsne", model.value().get(0).properties().mainPrincipal().applicationId()); + Assertions.assertEquals("dwzjeiach", model.value().get(0).properties().mainPrincipal().objectId()); + Assertions.assertEquals("osfln", model.value().get(0).properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.USER, model.value().get(0).properties().mainPrincipal().principalType()); + Assertions.assertEquals("qidtqajzyu", model.nextLink()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacePropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacePropertiesTests.java new file mode 100644 index 000000000000..b049b56f126c --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacePropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +import org.junit.jupiter.api.Assertions; + +public final class FleetspacePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FleetspaceProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Accepted\",\"capacityMax\":1695010462,\"mainPrincipal\":{\"login\":\"vtb\",\"applicationId\":\"ysszdnrujqguh\",\"objectId\":\"ouqfprwz\",\"tenantId\":\"nguitnwuizgazxu\",\"principalType\":\"Application\"}}") + .toObject(FleetspaceProperties.class); + Assertions.assertEquals(1695010462, model.capacityMax()); + Assertions.assertEquals("vtb", model.mainPrincipal().login()); + Assertions.assertEquals("ysszdnrujqguh", model.mainPrincipal().applicationId()); + Assertions.assertEquals("ouqfprwz", model.mainPrincipal().objectId()); + Assertions.assertEquals("nguitnwuizgazxu", model.mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.mainPrincipal().principalType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FleetspaceProperties model = new FleetspaceProperties().withCapacityMax(1695010462) + .withMainPrincipal(new MainPrincipal().withLogin("vtb") + .withApplicationId("ysszdnrujqguh") + .withObjectId("ouqfprwz") + .withTenantId("nguitnwuizgazxu") + .withPrincipalType(PrincipalType.APPLICATION)); + model = BinaryData.fromObject(model).toObject(FleetspaceProperties.class); + Assertions.assertEquals(1695010462, model.capacityMax()); + Assertions.assertEquals("vtb", model.mainPrincipal().login()); + Assertions.assertEquals("ysszdnrujqguh", model.mainPrincipal().applicationId()); + Assertions.assertEquals("ouqfprwz", model.mainPrincipal().objectId()); + Assertions.assertEquals("nguitnwuizgazxu", model.mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.mainPrincipal().principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..5915e676d854 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesCreateOrUpdateMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.FleetspaceProperties; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +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 FleetspacesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"capacityMax\":11356345,\"mainPrincipal\":{\"login\":\"ooxdjebwpuc\",\"applicationId\":\"fvovbvmeuecivy\",\"objectId\":\"ce\",\"tenantId\":\"jgjrwjueiotwm\",\"principalType\":\"Application\"}},\"id\":\"dxwitx\",\"name\":\"rjaw\",\"type\":\"qwgxhniskx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Fleetspace response = manager.fleetspaces() + .define("ahvljuaha") + .withExistingFleet("srtslhspkdeem", "ofmxagkvtmelmqkr") + .withProperties(new FleetspaceProperties().withCapacityMax(1312333731) + .withMainPrincipal(new MainPrincipal().withLogin("ualaexqpvfadmw") + .withApplicationId("crgvxpvgom") + .withObjectId("fmisg") + .withTenantId("nbbelda") + .withPrincipalType(PrincipalType.USER))) + .create(); + + Assertions.assertEquals(11356345, response.properties().capacityMax()); + Assertions.assertEquals("ooxdjebwpuc", response.properties().mainPrincipal().login()); + Assertions.assertEquals("fvovbvmeuecivy", response.properties().mainPrincipal().applicationId()); + Assertions.assertEquals("ce", response.properties().mainPrincipal().objectId()); + Assertions.assertEquals("jgjrwjueiotwm", response.properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, response.properties().mainPrincipal().principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetWithResponseMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetWithResponseMockTests.java new file mode 100644 index 000000000000..a3f5dcd466d1 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesGetWithResponseMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +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 FleetspacesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\",\"capacityMax\":636252983,\"mainPrincipal\":{\"login\":\"fcnj\",\"applicationId\":\"cn\",\"objectId\":\"hbttkphyw\",\"tenantId\":\"vjtoqnermclfp\",\"principalType\":\"Application\"}},\"id\":\"xus\",\"name\":\"rpabg\",\"type\":\"epsbjtazqu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Fleetspace response = manager.fleetspaces() + .getWithResponse("wrupqsxvnmicykvc", "o", "eil", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(636252983, response.properties().capacityMax()); + Assertions.assertEquals("fcnj", response.properties().mainPrincipal().login()); + Assertions.assertEquals("cn", response.properties().mainPrincipal().applicationId()); + Assertions.assertEquals("hbttkphyw", response.properties().mainPrincipal().objectId()); + Assertions.assertEquals("vjtoqnermclfp", response.properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, response.properties().mainPrincipal().principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetMockTests.java new file mode 100644 index 000000000000..25b058e654bc --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/FleetspacesListByFleetMockTests.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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.models.Fleetspace; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +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 FleetspacesListByFleetMockTests { + @Test + public void testListByFleet() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"capacityMax\":397011465,\"mainPrincipal\":{\"login\":\"txhdzh\",\"applicationId\":\"qj\",\"objectId\":\"ck\",\"tenantId\":\"lhrxsbkyvpyc\",\"principalType\":\"User\"}},\"id\":\"bpzkafkuwbc\",\"name\":\"nwbmeh\",\"type\":\"seyvj\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.fleetspaces() + .listByFleet("xywpmueefjzwfqkq", "jidsuyonobglaoc", 6109729315906421159L, 2903733515306491145L, + "mgyudxytlmoyrxv", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(397011465, response.iterator().next().properties().capacityMax()); + Assertions.assertEquals("txhdzh", response.iterator().next().properties().mainPrincipal().login()); + Assertions.assertEquals("qj", response.iterator().next().properties().mainPrincipal().applicationId()); + Assertions.assertEquals("ck", response.iterator().next().properties().mainPrincipal().objectId()); + Assertions.assertEquals("lhrxsbkyvpyc", response.iterator().next().properties().mainPrincipal().tenantId()); + Assertions.assertEquals(PrincipalType.USER, + response.iterator().next().properties().mainPrincipal().principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/IdentityTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/IdentityTests.java new file mode 100644 index 000000000000..35ace084b01d --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/IdentityTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DatabaseIdentity; +import com.azure.resourcemanager.databasefleetmanager.models.Identity; +import com.azure.resourcemanager.databasefleetmanager.models.IdentityType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Identity model = BinaryData.fromString( + "{\"identityType\":\"None\",\"userAssignedIdentities\":[{\"resourceId\":\"qjbasvms\",\"principalId\":\"qulngsntnbybkzgc\",\"clientId\":\"wclxxwrl\"},{\"resourceId\":\"ouskcqvkocrc\",\"principalId\":\"kwt\",\"clientId\":\"xbnjbiksq\"},{\"resourceId\":\"lssai\",\"principalId\":\"p\",\"clientId\":\"nzl\"},{\"resourceId\":\"fmppe\",\"principalId\":\"vmgxsab\",\"clientId\":\"qduujitcjczdz\"}],\"federatedClientId\":\"ndhkrw\"}") + .toObject(Identity.class); + Assertions.assertEquals(IdentityType.NONE, model.identityType()); + Assertions.assertEquals("qjbasvms", model.userAssignedIdentities().get(0).resourceId()); + Assertions.assertEquals("qulngsntnbybkzgc", model.userAssignedIdentities().get(0).principalId()); + Assertions.assertEquals("wclxxwrl", model.userAssignedIdentities().get(0).clientId()); + Assertions.assertEquals("ndhkrw", model.federatedClientId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Identity model = new Identity().withIdentityType(IdentityType.NONE) + .withUserAssignedIdentities(Arrays.asList( + new DatabaseIdentity().withResourceId("qjbasvms") + .withPrincipalId("qulngsntnbybkzgc") + .withClientId("wclxxwrl"), + new DatabaseIdentity().withResourceId("ouskcqvkocrc").withPrincipalId("kwt").withClientId("xbnjbiksq"), + new DatabaseIdentity().withResourceId("lssai").withPrincipalId("p").withClientId("nzl"), + new DatabaseIdentity().withResourceId("fmppe") + .withPrincipalId("vmgxsab") + .withClientId("qduujitcjczdz"))) + .withFederatedClientId("ndhkrw"); + model = BinaryData.fromObject(model).toObject(Identity.class); + Assertions.assertEquals(IdentityType.NONE, model.identityType()); + Assertions.assertEquals("qjbasvms", model.userAssignedIdentities().get(0).resourceId()); + Assertions.assertEquals("qulngsntnbybkzgc", model.userAssignedIdentities().get(0).principalId()); + Assertions.assertEquals("wclxxwrl", model.userAssignedIdentities().get(0).clientId()); + Assertions.assertEquals("ndhkrw", model.federatedClientId()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/MainPrincipalTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/MainPrincipalTests.java new file mode 100644 index 000000000000..d78e57cfe09b --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/MainPrincipalTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.MainPrincipal; +import com.azure.resourcemanager.databasefleetmanager.models.PrincipalType; +import org.junit.jupiter.api.Assertions; + +public final class MainPrincipalTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MainPrincipal model = BinaryData.fromString( + "{\"login\":\"ckyfih\",\"applicationId\":\"idf\",\"objectId\":\"wdzuhtymwisd\",\"tenantId\":\"thwxmnteiwaopvkm\",\"principalType\":\"Application\"}") + .toObject(MainPrincipal.class); + Assertions.assertEquals("ckyfih", model.login()); + Assertions.assertEquals("idf", model.applicationId()); + Assertions.assertEquals("wdzuhtymwisd", model.objectId()); + Assertions.assertEquals("thwxmnteiwaopvkm", model.tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.principalType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MainPrincipal model = new MainPrincipal().withLogin("ckyfih") + .withApplicationId("idf") + .withObjectId("wdzuhtymwisd") + .withTenantId("thwxmnteiwaopvkm") + .withPrincipalType(PrincipalType.APPLICATION); + model = BinaryData.fromObject(model).toObject(MainPrincipal.class); + Assertions.assertEquals("ckyfih", model.login()); + Assertions.assertEquals("idf", model.applicationId()); + Assertions.assertEquals("wdzuhtymwisd", model.objectId()); + Assertions.assertEquals("thwxmnteiwaopvkm", model.tenantId()); + Assertions.assertEquals(PrincipalType.APPLICATION, model.principalType()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationDisplayTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..fce47520cf91 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationInnerTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationInnerTests.java new file mode 100644 index 000000000000..5daf83f4ced8 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationListResultTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationListResultTests.java new file mode 100644 index 000000000000..bd2be9c7ee09 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationsListMockTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..2646a8ebe581 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/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.databasefleetmanager.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.databasefleetmanager.DatabasefleetmanagerManager; +import com.azure.resourcemanager.databasefleetmanager.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\":\"zfbuhf\",\"isDataAction\":true,\"display\":{\"provider\":\"k\",\"resource\":\"eiithlvmez\",\"operation\":\"shxmzsbbzoggigrx\",\"description\":\"ur\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DatabasefleetmanagerManager manager = DatabasefleetmanagerManager.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/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/RegisterServerPropertiesTests.java b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/RegisterServerPropertiesTests.java new file mode 100644 index 000000000000..67619ffcc404 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/src/test/java/com/azure/resourcemanager/databasefleetmanager/generated/RegisterServerPropertiesTests.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.databasefleetmanager.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databasefleetmanager.models.DestinationTierOverride; +import com.azure.resourcemanager.databasefleetmanager.models.RegisterServerProperties; +import com.azure.resourcemanager.databasefleetmanager.models.ResourceType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RegisterServerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RegisterServerProperties model = BinaryData.fromString( + "{\"tierName\":\"kudjkrlkhb\",\"sourceSubscriptionId\":\"fepgzgq\",\"sourceResourceGroupName\":\"zloc\",\"sourceServerName\":\"c\",\"destinationTierOverrides\":[{\"resourceType\":\"Pool\",\"tierName\":\"rhhbcs\",\"resourceName\":\"l\"},{\"resourceType\":\"Pool\",\"tierName\":\"majtjaod\",\"resourceName\":\"obnbdxkqpxokaj\"},{\"resourceType\":\"Pool\",\"tierName\":\"npime\",\"resourceName\":\"gstxgcp\"},{\"resourceType\":\"Database\",\"tierName\":\"gmaajrm\",\"resourceName\":\"djwzrlov\"}]}") + .toObject(RegisterServerProperties.class); + Assertions.assertEquals("kudjkrlkhb", model.tierName()); + Assertions.assertEquals("fepgzgq", model.sourceSubscriptionId()); + Assertions.assertEquals("zloc", model.sourceResourceGroupName()); + Assertions.assertEquals("c", model.sourceServerName()); + Assertions.assertEquals(ResourceType.POOL, model.destinationTierOverrides().get(0).resourceType()); + Assertions.assertEquals("rhhbcs", model.destinationTierOverrides().get(0).tierName()); + Assertions.assertEquals("l", model.destinationTierOverrides().get(0).resourceName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RegisterServerProperties model = new RegisterServerProperties().withTierName("kudjkrlkhb") + .withSourceSubscriptionId("fepgzgq") + .withSourceResourceGroupName("zloc") + .withSourceServerName("c") + .withDestinationTierOverrides(Arrays.asList( + new DestinationTierOverride().withResourceType(ResourceType.POOL) + .withTierName("rhhbcs") + .withResourceName("l"), + new DestinationTierOverride().withResourceType(ResourceType.POOL) + .withTierName("majtjaod") + .withResourceName("obnbdxkqpxokaj"), + new DestinationTierOverride().withResourceType(ResourceType.POOL) + .withTierName("npime") + .withResourceName("gstxgcp"), + new DestinationTierOverride().withResourceType(ResourceType.DATABASE) + .withTierName("gmaajrm") + .withResourceName("djwzrlov"))); + model = BinaryData.fromObject(model).toObject(RegisterServerProperties.class); + Assertions.assertEquals("kudjkrlkhb", model.tierName()); + Assertions.assertEquals("fepgzgq", model.sourceSubscriptionId()); + Assertions.assertEquals("zloc", model.sourceResourceGroupName()); + Assertions.assertEquals("c", model.sourceServerName()); + Assertions.assertEquals(ResourceType.POOL, model.destinationTierOverrides().get(0).resourceType()); + Assertions.assertEquals("rhhbcs", model.destinationTierOverrides().get(0).tierName()); + Assertions.assertEquals("l", model.destinationTierOverrides().get(0).resourceName()); + } +} diff --git a/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/tsp-location.yaml b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/tsp-location.yaml new file mode 100644 index 000000000000..49d2f93fbf79 --- /dev/null +++ b/sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasefleetmanager/DatabaseFleetManager.Management +commit: 6e702986ee542ebd38d0ab2e2f2c00ab48a50b45 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/databasefleetmanager/ci.yml b/sdk/databasefleetmanager/ci.yml new file mode 100644 index 000000000000..9ecc4e3cfd0a --- /dev/null +++ b/sdk/databasefleetmanager/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/databasefleetmanager/ci.yml + - sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/ + exclude: + - sdk/databasefleetmanager/pom.xml + - sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databasefleetmanager/ci.yml + - sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/ + exclude: + - sdk/databasefleetmanager/pom.xml + - sdk/databasefleetmanager/azure-resourcemanager-databasefleetmanager/pom.xml + +parameters: + - name: release_azureresourcemanagerdatabasefleetmanager + displayName: azure-resourcemanager-databasefleetmanager + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: databasefleetmanager + Artifacts: + - name: azure-resourcemanager-databasefleetmanager + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdatabasefleetmanager + releaseInBatch: ${{ parameters.release_azureresourcemanagerdatabasefleetmanager }} diff --git a/sdk/databasefleetmanager/pom.xml b/sdk/databasefleetmanager/pom.xml new file mode 100644 index 000000000000..e4bafd3e4242 --- /dev/null +++ b/sdk/databasefleetmanager/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-databasefleetmanager-service + pom + 1.0.0 + + + azure-resourcemanager-databasefleetmanager + +