diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2451b62e26cf2..0650c49852511 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -479,6 +479,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerorchestratorruntime;1.0 com.azure.resourcemanager:azure-resourcemanager-terraform;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-connectedcache;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-neonpostgres;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-azurefleet;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 6d0fed5556e45..4084278ba1291 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ sdk/avs sdk/azureadexternalidentities sdk/azurearcdata + sdk/azurefleet sdk/azurestack sdk/azurestackhci sdk/baremetalinfrastructure diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/CHANGELOG.md b/sdk/azurefleet/azure-resourcemanager-azurefleet/CHANGELOG.md new file mode 100644 index 0000000000000..f5c66807657b4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-12-16) + +- Azure Resource Manager azurefleet client library for Java. This package contains Microsoft Azure SDK for azurefleet Management SDK. Package tag package-2024-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-azurefleet Java SDK. diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/README.md b/sdk/azurefleet/azure-resourcemanager-azurefleet/README.md new file mode 100644 index 0000000000000..8d75baded65b1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager azurefleet client library for Java + +Azure Resource Manager azurefleet client library for Java. + +This package contains Microsoft Azure SDK for azurefleet Management SDK. Package tag package-2024-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-azurefleet;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-azurefleet + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AzurefleetManager manager = AzurefleetManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/azurefleet/azure-resourcemanager-azurefleet/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fazurefleet%2Fazure-resourcemanager-azurefleet%2FREADME.png) diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/SAMPLE.md b/sdk/azurefleet/azure-resourcemanager-azurefleet/SAMPLE.md new file mode 100644 index 0000000000000..a11b1096c60fa --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/SAMPLE.md @@ -0,0 +1,976 @@ +# Code snippets and samples + + +## Fleets + +- [CreateOrUpdate](#fleets_createorupdate) +- [Delete](#fleets_delete) +- [GetByResourceGroup](#fleets_getbyresourcegroup) +- [List](#fleets_list) +- [ListByResourceGroup](#fleets_listbyresourcegroup) +- [ListVirtualMachineScaleSets](#fleets_listvirtualmachinescalesets) +- [Update](#fleets_update) + +## Operations + +- [List](#operations_list) +### Fleets_CreateOrUpdate + +```java +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContent; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentComponentName; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentPassName; +import com.azure.resourcemanager.azurefleet.models.ApiEntityReference; +import com.azure.resourcemanager.azurefleet.models.ApplicationProfile; +import com.azure.resourcemanager.azurefleet.models.BaseVirtualMachineProfile; +import com.azure.resourcemanager.azurefleet.models.BootDiagnostics; +import com.azure.resourcemanager.azurefleet.models.CachingTypes; +import com.azure.resourcemanager.azurefleet.models.CapacityReservationProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.DeleteOptions; +import com.azure.resourcemanager.azurefleet.models.DiagnosticsProfile; +import com.azure.resourcemanager.azurefleet.models.DiffDiskOptions; +import com.azure.resourcemanager.azurefleet.models.DiffDiskPlacement; +import com.azure.resourcemanager.azurefleet.models.DiffDiskSettings; +import com.azure.resourcemanager.azurefleet.models.DiskControllerTypes; +import com.azure.resourcemanager.azurefleet.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.azurefleet.models.DomainNameLabelScopeTypes; +import com.azure.resourcemanager.azurefleet.models.EncryptionIdentity; +import com.azure.resourcemanager.azurefleet.models.EvictionPolicy; +import com.azure.resourcemanager.azurefleet.models.ImageReference; +import com.azure.resourcemanager.azurefleet.models.IpVersion; +import com.azure.resourcemanager.azurefleet.models.KeyVaultSecretReference; +import com.azure.resourcemanager.azurefleet.models.LinuxConfiguration; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.azurefleet.models.Mode; +import com.azure.resourcemanager.azurefleet.models.NetworkApiVersion; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliaryMode; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliarySku; +import com.azure.resourcemanager.azurefleet.models.OSImageNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurefleet.models.PatchSettings; +import com.azure.resourcemanager.azurefleet.models.Plan; +import com.azure.resourcemanager.azurefleet.models.ProtocolTypes; +import com.azure.resourcemanager.azurefleet.models.ProxyAgentSettings; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSku; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.ScheduledEventsProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.azurefleet.models.SecurityPostureReference; +import com.azure.resourcemanager.azurefleet.models.SecurityProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityTypes; +import com.azure.resourcemanager.azurefleet.models.ServiceArtifactReference; +import com.azure.resourcemanager.azurefleet.models.SettingNames; +import com.azure.resourcemanager.azurefleet.models.SpotAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SshConfiguration; +import com.azure.resourcemanager.azurefleet.models.SshPublicKey; +import com.azure.resourcemanager.azurefleet.models.StorageAccountTypes; +import com.azure.resourcemanager.azurefleet.models.TerminateNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.UefiSettings; +import com.azure.resourcemanager.azurefleet.models.UserAssignedIdentity; +import com.azure.resourcemanager.azurefleet.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurefleet.models.VMGalleryApplication; +import com.azure.resourcemanager.azurefleet.models.VMSizeProperties; +import com.azure.resourcemanager.azurefleet.models.VaultCertificate; +import com.azure.resourcemanager.azurefleet.models.VaultSecretGroup; +import com.azure.resourcemanager.azurefleet.models.VirtualHardDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import com.azure.resourcemanager.azurefleet.models.WinRMConfiguration; +import com.azure.resourcemanager.azurefleet.models.WinRMListener; +import com.azure.resourcemanager.azurefleet.models.WindowsConfiguration; +import com.azure.resourcemanager.azurefleet.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets CreateOrUpdate. + */ +public final class FleetsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_CreateOrUpdate. + * json + */ + /** + * Sample code: Fleets_CreateOrUpdate. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsCreateOrUpdate(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets() + .define("testFleet") + .withRegion("westus") + .withExistingResourceGroup("rgazurefleet") + .withTags(mapOf("key3518", "fakeTokenPlaceholder")) + .withZones(Arrays.asList("zone1", "zone2")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("key9851", new UserAssignedIdentity()))) + .withPlan(new Plan().withName("jwgrcrnrtfoxn") + .withPublisher("iozjbiqqckqm") + .withProduct("cgopbyvdyqikahwyxfpzwaqk") + .withPromotionCode("fakeTokenPlaceholder") + .withVersion("wa")) + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withMaxPricePerVM(0.00865F) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_d1_v2").withRank(19225))) + .withComputeProfile( + new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("o") + .withAdminUsername("nrgzqciiaaxjrqldbmjbqkyhntp") + .withAdminPassword("fakeTokenPlaceholder") + .withCustomData("xjjib") + .withWindowsConfiguration(new WindowsConfiguration().withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("hlyjiqcfksgrpjrct") + .withAdditionalUnattendContent( + Arrays.asList(new AdditionalUnattendContent() + .withPassName(AdditionalUnattendContentPassName.OOBE_SYSTEM) + .withComponentName( + AdditionalUnattendContentComponentName.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("bubmqbxjkj"))) + .withPatchSettings(new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new WindowsVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + WindowsVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withWinRM(new WinRMConfiguration() + .withListeners(Arrays.asList(new WinRMListener().withProtocol(ProtocolTypes.HTTPS) + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName")))) + .withEnableVMAgentPlatformUpdates(true)) + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true) + .withSsh(new SshConfiguration().withPublicKeys(Arrays + .asList(new SshPublicKey().withPath("kmqz").withKeyData("fakeTokenPlaceholder")))) + .withProvisionVMAgent(true) + .withPatchSettings(new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings(new LinuxVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting(LinuxVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withEnableVMAgentPlatformUpdates(true)) + .withSecrets(Arrays.asList(new VaultSecretGroup().withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")) + .withVaultCertificates(Arrays.asList(new VaultCertificate() + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName") + .withCertificateStore("nlxrwavpzhueffxsshlun"))))) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}") + .withPublisher("mqxgwbiyjzmxavhbkd") + .withOffer("isxgumkarlkomp") + .withSku("eojmppqcrnpmxirtp") + .withVersion("wvpcqefgtmqdgltiuz") + .withSharedGalleryImageId("kmkgihoxwlawuuhcinfirktdwkmx") + .withCommunityGalleryImageId("vlqe")) + .withOsDisk(new VirtualMachineScaleSetOSDisk().withName("wfttw") + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withDiskSizeGB(14) + .withOsType(OperatingSystemTypes.WINDOWS) + .withImage(new VirtualHardDisk().withUri( + "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd")) + .withVhdContainers(Arrays.asList("tkzcwddtinkfpnfklatw")) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks(Arrays.asList(new VirtualMachineScaleSetDataDisk() + .withName("eogiykmdmeikswxmigjws") + .withLun(14) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(6) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDiskIopsReadWrite(27L) + .withDiskMBpsReadWrite(2L) + .withDeleteOption(DiskDeleteOptionTypes.DELETE))) + .withDiskControllerType(DiskControllerTypes.fromString("uzb"))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile() + .withHealthProbe(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}")) + .withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("i") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties() + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withDisableTcpStateTracking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}")) + .withDnsSettings(new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList("nxmmfolhclsesu"))) + .withIpConfigurations(Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("oezqhkidfhyywlfzwuotilrpbqnjg") + .withProperties(new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("fvpqf") + .withProperties( + new VirtualMachineScaleSetPublicIpAddressConfigurationProperties() + .withIdleTimeoutInMinutes(9) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("ukrddzvmorpmfsczjwtbvp") + .withDomainNameLabelScope( + DomainNameLabelScopeTypes.TENANT_REUSE)) + .withIpTags( + Arrays.asList(new VirtualMachineScaleSetIpTag() + .withIpTagType("sddgsoemnzgqizale") + .withTag("wufmhrjsakbiaetyara"))) + .withPublicIpPrefix(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withSku(new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL))) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"))) + .withApplicationSecurityGroups(Arrays.asList( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"))) + .withLoadBalancerBackendAddressPools(Arrays.asList( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"))) + .withLoadBalancerInboundNatPools( + Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}")))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE) + .withAuxiliaryMode(NetworkInterfaceAuxiliaryMode.NONE) + .withAuxiliarySku(NetworkInterfaceAuxiliarySku.NONE)))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile(new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH) + .withEncryptionIdentity(new EncryptionIdentity().withUserAssignedIdentityResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}")) + .withProxyAgentSettings(new ProxyAgentSettings().withEnabled(true) + .withMode(Mode.AUDIT) + .withKeyIncarnationId(20))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://myStorageAccountName.blob.core.windows.net"))) + .withExtensionProfile(new VirtualMachineScaleSetExtensionProfile() + .withExtensions(Arrays.asList(new VirtualMachineScaleSetExtension().withName("bndxuxx") + .withProperties(new VirtualMachineScaleSetExtensionProperties() + .withForceUpdateTag("yhgxw") + .withPublisher("kpxtirxjfprhs") + .withType("pgjilctjjwaa") + .withTypeHandlerVersion("zevivcoilxmbwlrihhhibq") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings(mapOf()) + .withProtectedSettings(mapOf()) + .withProvisionAfterExtensions(Arrays.asList("nftzosroolbcwmpupujzqwqe")) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault(new KeyVaultSecretReference() + .withSecretUrl("fakeTokenPlaceholder") + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")))))) + .withExtensionsTimeBudget("mbhjahtdygwgyszdwjtvlvtgchdwil")) + .withLicenseType("v") + .withScheduledEventsProfile(new ScheduledEventsProfile() + .withTerminateNotificationProfile(new TerminateNotificationProfile() + .withNotBeforeTimeout("iljppmmw") + .withEnable(true)) + .withOsImageNotificationProfile( + new OSImageNotificationProfile().withNotBeforeTimeout("olbpadmevekyczfokodtfprxti") + .withEnable(true))) + .withUserData("s") + .withCapacityReservation(new CapacityReservationProfile() + .withCapacityReservationGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"))) + .withApplicationProfile(new ApplicationProfile().withGalleryApplications( + Arrays.asList(new VMGalleryApplication().withTags("eyrqjbib") + .withOrder(5) + .withPackageReferenceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}") + .withConfigurationReference("ulztmiavpojpbpbddgnuuiimxcpau") + .withTreatFailureAsDeploymentFailure(true) + .withEnableAutomaticUpgrade(true)))) + .withHardwareProfile(new VirtualMachineScaleSetHardwareProfile() + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(16).withVCpusPerCore(23))) + .withServiceArtifactReference(new ServiceArtifactReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}")) + .withSecurityPostureReference(new SecurityPostureReference().withId( + "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest") + .withExcludeExtensions(Arrays.asList("{securityPostureVMExtensionName}")) + .withIsOverridable(true))) + .withComputeApiVersion("2023-07-01") + .withPlatformFaultDomainCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_CreateOrUpdate_MinimumSet.json + */ + /** + * Sample code: Fleets_CreateOrUpdate_MinimumSet. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsCreateOrUpdateMinimumSet(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets() + .define("testFleet") + .withRegion("eastus2euap") + .withExistingResourceGroup("rgazurefleet") + .withTags(mapOf("key", "fakeTokenPlaceholder")) + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(2) + .withMinCapacity(1) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(2) + .withMinCapacity(1) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_D2s_v3"), + new VmSizeProfile().withName("Standard_D4s_v3"), new VmSizeProfile().withName("Standard_E2s_v3"))) + .withComputeProfile(new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("prefix") + .withAdminUsername("azureuser") + .withAdminPassword("fakeTokenPlaceholder") + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(false))) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withPublisher("canonical") + .withOffer("0001-com-ubuntu-server-focal") + .withSku("20_04-lts-gen2") + .withVersion("latest")) + .withOsDisk(new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withOsType(OperatingSystemTypes.LINUX) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile().withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("vmNameTest") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties().withPrimary(true) + .withEnableAcceleratedNetworking(false) + .withIpConfigurations(Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("vmNameTest") + .withProperties(new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withLoadBalancerBackendAddressPools(Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}")))))) + .withEnableIpForwarding(true)))) + .withNetworkApiVersion(NetworkApiVersion.fromString("2022-07-01")))) + .withComputeApiVersion("2023-09-01") + .withPlatformFaultDomainCount(1)) + .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_Delete + +```java +/** + * Samples for Fleets Delete. + */ +public final class FleetsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Delete.json + */ + /** + * Sample code: Fleets_Delete. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsDelete(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().delete("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_GetByResourceGroup + +```java +/** + * Samples for Fleets GetByResourceGroup. + */ +public final class FleetsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Get.json + */ + /** + * Sample code: Fleets_Get. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsGet(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().getByResourceGroupWithResponse("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_List + +```java +/** + * Samples for Fleets List. + */ +public final class FleetsListSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListBySubscription.json + */ + /** + * Sample code: Fleets_ListBySubscription. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsListBySubscription(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_ListByResourceGroup + +```java +/** + * Samples for Fleets ListByResourceGroup. + */ +public final class FleetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListByResourceGroup.json + */ + /** + * Sample code: Fleets_ListByResourceGroup. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsListByResourceGroup(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().listByResourceGroup("rgazurefleet", com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_ListVirtualMachineScaleSets + +```java +/** + * Samples for Fleets ListVirtualMachineScaleSets. + */ +public final class FleetsListVirtualMachineScaleSetsSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListVirtualMachineScaleSets.json + */ + /** + * Sample code: Fleets_ListVirtualMachineScaleSets. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void + fleetsListVirtualMachineScaleSets(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().listVirtualMachineScaleSets("rgazurefleet", "myFleet", com.azure.core.util.Context.NONE); + } +} +``` + +### Fleets_Update + +```java +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetProperties; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContent; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentComponentName; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentPassName; +import com.azure.resourcemanager.azurefleet.models.ApiEntityReference; +import com.azure.resourcemanager.azurefleet.models.ApplicationProfile; +import com.azure.resourcemanager.azurefleet.models.BaseVirtualMachineProfile; +import com.azure.resourcemanager.azurefleet.models.BootDiagnostics; +import com.azure.resourcemanager.azurefleet.models.CachingTypes; +import com.azure.resourcemanager.azurefleet.models.CapacityReservationProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.DeleteOptions; +import com.azure.resourcemanager.azurefleet.models.DiagnosticsProfile; +import com.azure.resourcemanager.azurefleet.models.DiffDiskOptions; +import com.azure.resourcemanager.azurefleet.models.DiffDiskPlacement; +import com.azure.resourcemanager.azurefleet.models.DiffDiskSettings; +import com.azure.resourcemanager.azurefleet.models.DiskControllerTypes; +import com.azure.resourcemanager.azurefleet.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.azurefleet.models.DomainNameLabelScopeTypes; +import com.azure.resourcemanager.azurefleet.models.EncryptionIdentity; +import com.azure.resourcemanager.azurefleet.models.EvictionPolicy; +import com.azure.resourcemanager.azurefleet.models.Fleet; +import com.azure.resourcemanager.azurefleet.models.ImageReference; +import com.azure.resourcemanager.azurefleet.models.IpVersion; +import com.azure.resourcemanager.azurefleet.models.KeyVaultSecretReference; +import com.azure.resourcemanager.azurefleet.models.LinuxConfiguration; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityUpdate; +import com.azure.resourcemanager.azurefleet.models.Mode; +import com.azure.resourcemanager.azurefleet.models.NetworkApiVersion; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliaryMode; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliarySku; +import com.azure.resourcemanager.azurefleet.models.OSImageNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurefleet.models.PatchSettings; +import com.azure.resourcemanager.azurefleet.models.ProtocolTypes; +import com.azure.resourcemanager.azurefleet.models.ProxyAgentSettings; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSku; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.ResourcePlanUpdate; +import com.azure.resourcemanager.azurefleet.models.ScheduledEventsProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.azurefleet.models.SecurityPostureReference; +import com.azure.resourcemanager.azurefleet.models.SecurityProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityTypes; +import com.azure.resourcemanager.azurefleet.models.ServiceArtifactReference; +import com.azure.resourcemanager.azurefleet.models.SettingNames; +import com.azure.resourcemanager.azurefleet.models.SpotAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SshConfiguration; +import com.azure.resourcemanager.azurefleet.models.SshPublicKey; +import com.azure.resourcemanager.azurefleet.models.StorageAccountTypes; +import com.azure.resourcemanager.azurefleet.models.TerminateNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.UefiSettings; +import com.azure.resourcemanager.azurefleet.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurefleet.models.VMGalleryApplication; +import com.azure.resourcemanager.azurefleet.models.VMSizeProperties; +import com.azure.resourcemanager.azurefleet.models.VaultCertificate; +import com.azure.resourcemanager.azurefleet.models.VaultSecretGroup; +import com.azure.resourcemanager.azurefleet.models.VirtualHardDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import com.azure.resourcemanager.azurefleet.models.WinRMConfiguration; +import com.azure.resourcemanager.azurefleet.models.WinRMListener; +import com.azure.resourcemanager.azurefleet.models.WindowsConfiguration; +import com.azure.resourcemanager.azurefleet.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets Update. + */ +public final class FleetsUpdateSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Update.json + */ + /** + * Sample code: Fleets_Update. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsUpdate(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + Fleet resource = manager.fleets() + .getByResourceGroupWithResponse("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withIdentity(new ManagedServiceIdentityUpdate().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withPlan(new ResourcePlanUpdate().withName("jwgrcrnrtfoxn") + .withPublisher("iozjbiqqckqm") + .withProduct("cgopbyvdyqikahwyxfpzwaqk") + .withPromotionCode("fakeTokenPlaceholder") + .withVersion("wa")) + .withProperties(new FleetProperties() + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withMaxPricePerVM(0.00865F) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_d1_v2").withRank(19225))) + .withComputeProfile( + new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("o") + .withAdminUsername("nrgzqciiaaxjrqldbmjbqkyhntp") + .withAdminPassword("fakeTokenPlaceholder") + .withCustomData("xjjib") + .withWindowsConfiguration(new WindowsConfiguration().withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("hlyjiqcfksgrpjrct") + .withAdditionalUnattendContent( + Arrays.asList(new AdditionalUnattendContent() + .withPassName(AdditionalUnattendContentPassName.OOBE_SYSTEM) + .withComponentName( + AdditionalUnattendContentComponentName.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("bubmqbxjkj"))) + .withPatchSettings(new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new WindowsVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + WindowsVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withWinRM(new WinRMConfiguration().withListeners(Arrays.asList(new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName")))) + .withEnableVMAgentPlatformUpdates(true)) + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true) + .withSsh(new SshConfiguration().withPublicKeys(Arrays.asList( + new SshPublicKey().withPath("kmqz").withKeyData("fakeTokenPlaceholder")))) + .withProvisionVMAgent(true) + .withPatchSettings(new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new LinuxVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + LinuxVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withEnableVMAgentPlatformUpdates(true)) + .withSecrets(Arrays.asList(new VaultSecretGroup() + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")) + .withVaultCertificates(Arrays.asList(new VaultCertificate() + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName") + .withCertificateStore("nlxrwavpzhueffxsshlun"))))) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}") + .withPublisher("mqxgwbiyjzmxavhbkd") + .withOffer("isxgumkarlkomp") + .withSku("eojmppqcrnpmxirtp") + .withVersion("wvpcqefgtmqdgltiuz") + .withSharedGalleryImageId("kmkgihoxwlawuuhcinfirktdwkmx") + .withCommunityGalleryImageId("vlqe")) + .withOsDisk(new VirtualMachineScaleSetOSDisk().withName("wfttw") + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withDiskSizeGB(14) + .withOsType(OperatingSystemTypes.WINDOWS) + .withImage(new VirtualHardDisk().withUri( + "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd")) + .withVhdContainers(Arrays.asList("tkzcwddtinkfpnfklatw")) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks(Arrays.asList(new VirtualMachineScaleSetDataDisk() + .withName("eogiykmdmeikswxmigjws") + .withLun(14) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(6) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDiskIopsReadWrite(27L) + .withDiskMBpsReadWrite(2L) + .withDeleteOption(DiskDeleteOptionTypes.DELETE))) + .withDiskControllerType(DiskControllerTypes.fromString("uzb"))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile() + .withHealthProbe(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}")) + .withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("i") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties() + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withDisableTcpStateTracking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}")) + .withDnsSettings(new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList("nxmmfolhclsesu"))) + .withIpConfigurations( + Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("oezqhkidfhyywlfzwuotilrpbqnjg") + .withProperties( + new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("fvpqf") + .withProperties( + new VirtualMachineScaleSetPublicIpAddressConfigurationProperties() + .withIdleTimeoutInMinutes(9) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel( + "ukrddzvmorpmfsczjwtbvp") + .withDomainNameLabelScope( + DomainNameLabelScopeTypes.TENANT_REUSE)) + .withIpTags(Arrays.asList( + new VirtualMachineScaleSetIpTag() + .withIpTagType("sddgsoemnzgqizale") + .withTag("wufmhrjsakbiaetyara"))) + .withPublicIpPrefix( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withSku(new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL))) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"))) + .withApplicationSecurityGroups(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"))) + .withLoadBalancerBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"))) + .withLoadBalancerInboundNatPools( + Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}")))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE) + .withAuxiliaryMode(NetworkInterfaceAuxiliaryMode.NONE) + .withAuxiliarySku(NetworkInterfaceAuxiliarySku.NONE)))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile(new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH) + .withEncryptionIdentity(new EncryptionIdentity().withUserAssignedIdentityResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}")) + .withProxyAgentSettings(new ProxyAgentSettings().withEnabled(true) + .withMode(Mode.AUDIT) + .withKeyIncarnationId(20))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://myStorageAccountName.blob.core.windows.net"))) + .withExtensionProfile(new VirtualMachineScaleSetExtensionProfile() + .withExtensions(Arrays.asList(new VirtualMachineScaleSetExtension().withName("bndxuxx") + .withProperties(new VirtualMachineScaleSetExtensionProperties() + .withForceUpdateTag("yhgxw") + .withPublisher("kpxtirxjfprhs") + .withType("pgjilctjjwaa") + .withTypeHandlerVersion("zevivcoilxmbwlrihhhibq") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings(mapOf()) + .withProtectedSettings(mapOf()) + .withProvisionAfterExtensions(Arrays.asList("nftzosroolbcwmpupujzqwqe")) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault(new KeyVaultSecretReference() + .withSecretUrl("fakeTokenPlaceholder") + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")))))) + .withExtensionsTimeBudget("mbhjahtdygwgyszdwjtvlvtgchdwil")) + .withLicenseType("v") + .withScheduledEventsProfile(new ScheduledEventsProfile() + .withTerminateNotificationProfile(new TerminateNotificationProfile() + .withNotBeforeTimeout("iljppmmw") + .withEnable(true)) + .withOsImageNotificationProfile( + new OSImageNotificationProfile().withNotBeforeTimeout("olbpadmevekyczfokodtfprxti") + .withEnable(true))) + .withUserData("s") + .withCapacityReservation(new CapacityReservationProfile() + .withCapacityReservationGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"))) + .withApplicationProfile(new ApplicationProfile().withGalleryApplications( + Arrays.asList(new VMGalleryApplication().withTags("eyrqjbib") + .withOrder(5) + .withPackageReferenceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}") + .withConfigurationReference("ulztmiavpojpbpbddgnuuiimxcpau") + .withTreatFailureAsDeploymentFailure(true) + .withEnableAutomaticUpgrade(true)))) + .withHardwareProfile( + new VirtualMachineScaleSetHardwareProfile().withVmSizeProperties(new VMSizeProperties() + .withVCpusAvailable(16) + .withVCpusPerCore(23))) + .withServiceArtifactReference(new ServiceArtifactReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}")) + .withSecurityPostureReference(new SecurityPostureReference().withId( + "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest") + .withExcludeExtensions(Arrays.asList("{securityPostureVMExtensionName}")) + .withIsOverridable(true))) + .withComputeApiVersion("2023-07-01") + .withPlatformFaultDomainCount(1))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void operationsList(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/pom.xml b/sdk/azurefleet/azure-resourcemanager-azurefleet/pom.xml new file mode 100644 index 0000000000000..c6699870a0b4c --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-azurefleet + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for azurefleet Management + This package contains Microsoft Azure SDK for azurefleet Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-11-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + false + + + + com.azure + azure-core + 1.54.1 + + + com.azure + azure-core-management + 1.15.6 + + + diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/AzurefleetManager.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/AzurefleetManager.java new file mode 100644 index 0000000000000..a162186ac454f --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/AzurefleetManager.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet; + +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.logging.ClientLogger; +import com.azure.resourcemanager.azurefleet.fluent.MicrosoftAzureFleet; +import com.azure.resourcemanager.azurefleet.implementation.FleetsImpl; +import com.azure.resourcemanager.azurefleet.implementation.MicrosoftAzureFleetBuilder; +import com.azure.resourcemanager.azurefleet.implementation.OperationsImpl; +import com.azure.resourcemanager.azurefleet.models.Fleets; +import com.azure.resourcemanager.azurefleet.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to AzurefleetManager. + */ +public final class AzurefleetManager { + private Operations operations; + + private Fleets fleets; + + private final MicrosoftAzureFleet clientObject; + + private AzurefleetManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftAzureFleetBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of azurefleet service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the azurefleet service API instance. + */ + public static AzurefleetManager 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 azurefleet service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the azurefleet service API instance. + */ + public static AzurefleetManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AzurefleetManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AzurefleetManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzurefleetManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of azurefleet service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the azurefleet service API instance. + */ + public AzurefleetManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.azurefleet") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new 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 AzurefleetManager(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 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 wrapped service client MicrosoftAzureFleet providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftAzureFleet. + */ + public MicrosoftAzureFleet serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/FleetsClient.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/FleetsClient.java new file mode 100644 index 0000000000000..a739bce2c9689 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/FleetsClient.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.azurefleet.models.FleetUpdate; + +/** + * An instance of this class provides access to all the operations defined in FleetsClient. + */ +public interface FleetsClient { + /** + * List Fleet resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Fleet resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, Context context); + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner getByResourceGroup(String resourceGroupName, String fleetName); + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, String fleetName, + FleetInner resource); + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, String fleetName, + FleetInner resource, Context context); + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource); + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource, Context context); + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties); + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties, Context context); + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties); + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties, Context context); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name); + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name, + Context context); +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/MicrosoftAzureFleet.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/MicrosoftAzureFleet.java new file mode 100644 index 0000000000000..a0c149138de03 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/MicrosoftAzureFleet.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftAzureFleet class. + */ +public interface MicrosoftAzureFleet { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the FleetsClient object to access its operations. + * + * @return the FleetsClient object. + */ + FleetsClient getFleets(); +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/OperationsClient.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/OperationsClient.java new file mode 100644 index 0000000000000..286f74f260aca --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetInner.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetInner.java new file mode 100644 index 0000000000000..152d2fbafa0ba --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetInner.java @@ -0,0 +1,449 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.models.AdditionalLocationsProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurefleet.models.Plan; +import com.azure.resourcemanager.azurefleet.models.ProvisioningState; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.VMAttributes; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** + * An Compute Fleet resource. + */ +@Fluent +public final class FleetInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private FleetProperties innerProperties; + + /* + * Zones in which the Compute Fleet is available + */ + private List zones; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Details of the resource plan. + */ + private Plan plan; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private FleetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the zones property: Zones in which the Compute Fleet is available. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: Zones in which the Compute Fleet is available. + * + * @param zones the zones value to set. + * @return the FleetInner object itself. + */ + public FleetInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the FleetInner object itself. + */ + public FleetInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the plan property: Details of the resource plan. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Details of the resource plan. + * + * @param plan the plan value to set. + * @return the FleetInner object itself. + */ + public FleetInner withPlan(Plan plan) { + this.plan = plan; + 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; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet. + * + * @return the spotPriorityProfile value. + */ + public SpotPriorityProfile spotPriorityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().spotPriorityProfile(); + } + + /** + * Set the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet. + * + * @param spotPriorityProfile the spotPriorityProfile value to set. + * @return the FleetInner object itself. + */ + public FleetInner withSpotPriorityProfile(SpotPriorityProfile spotPriorityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withSpotPriorityProfile(spotPriorityProfile); + return this; + } + + /** + * Get the regularPriorityProfile property: Configuration Options for Regular instances in Compute Fleet. + * + * @return the regularPriorityProfile value. + */ + public RegularPriorityProfile regularPriorityProfile() { + return this.innerProperties() == null ? null : this.innerProperties().regularPriorityProfile(); + } + + /** + * Set the regularPriorityProfile property: Configuration Options for Regular instances in Compute Fleet. + * + * @param regularPriorityProfile the regularPriorityProfile value to set. + * @return the FleetInner object itself. + */ + public FleetInner withRegularPriorityProfile(RegularPriorityProfile regularPriorityProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withRegularPriorityProfile(regularPriorityProfile); + return this; + } + + /** + * Get the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @return the vmSizesProfile value. + */ + public List vmSizesProfile() { + return this.innerProperties() == null ? null : this.innerProperties().vmSizesProfile(); + } + + /** + * Set the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @param vmSizesProfile the vmSizesProfile value to set. + * @return the FleetInner object itself. + */ + public FleetInner withVmSizesProfile(List vmSizesProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withVmSizesProfile(vmSizesProfile); + return this; + } + + /** + * Get the vmAttributes property: Attribute based Fleet. + * + * @return the vmAttributes value. + */ + public VMAttributes vmAttributes() { + return this.innerProperties() == null ? null : this.innerProperties().vmAttributes(); + } + + /** + * Set the vmAttributes property: Attribute based Fleet. + * + * @param vmAttributes the vmAttributes value to set. + * @return the FleetInner object itself. + */ + public FleetInner withVmAttributes(VMAttributes vmAttributes) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withVmAttributes(vmAttributes); + return this; + } + + /** + * Get the additionalLocationsProfile property: Represents the configuration for additional locations where Fleet + * resources may be deployed. + * + * @return the additionalLocationsProfile value. + */ + public AdditionalLocationsProfile additionalLocationsProfile() { + return this.innerProperties() == null ? null : this.innerProperties().additionalLocationsProfile(); + } + + /** + * Set the additionalLocationsProfile property: Represents the configuration for additional locations where Fleet + * resources may be deployed. + * + * @param additionalLocationsProfile the additionalLocationsProfile value to set. + * @return the FleetInner object itself. + */ + public FleetInner withAdditionalLocationsProfile(AdditionalLocationsProfile additionalLocationsProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withAdditionalLocationsProfile(additionalLocationsProfile); + return this; + } + + /** + * Get the computeProfile property: Compute Profile to use for running user's workloads. + * + * @return the computeProfile value. + */ + public ComputeProfile computeProfile() { + return this.innerProperties() == null ? null : this.innerProperties().computeProfile(); + } + + /** + * Set the computeProfile property: Compute Profile to use for running user's workloads. + * + * @param computeProfile the computeProfile value to set. + * @return the FleetInner object itself. + */ + public FleetInner withComputeProfile(ComputeProfile computeProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new FleetProperties(); + } + this.innerProperties().withComputeProfile(computeProfile); + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Compute Fleet is created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Get the uniqueId property: Specifies the ID which uniquely identifies a Compute Fleet. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.innerProperties() == null ? null : this.innerProperties().uniqueId(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (plan() != null) { + plan().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.innerProperties); + jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("plan", this.plan); + 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.innerProperties = FleetProperties.fromJson(reader); + } else if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedFleetInner.zones = zones; + } else if ("identity".equals(fieldName)) { + deserializedFleetInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("plan".equals(fieldName)) { + deserializedFleetInner.plan = Plan.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFleetInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetInner; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetProperties.java new file mode 100644 index 0000000000000..f4e16cc66a889 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/FleetProperties.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +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.azurefleet.models.AdditionalLocationsProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.ProvisioningState; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.VMAttributes; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Details of the Compute Fleet. + */ +@Fluent +public final class FleetProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Configuration Options for Spot instances in Compute Fleet. + */ + private SpotPriorityProfile spotPriorityProfile; + + /* + * Configuration Options for Regular instances in Compute Fleet. + */ + private RegularPriorityProfile regularPriorityProfile; + + /* + * List of VM sizes supported for Compute Fleet + */ + private List vmSizesProfile; + + /* + * Attribute based Fleet. + */ + private VMAttributes vmAttributes; + + /* + * Represents the configuration for additional locations where Fleet resources may be deployed. + */ + private AdditionalLocationsProfile additionalLocationsProfile; + + /* + * Compute Profile to use for running user's workloads. + */ + private ComputeProfile computeProfile; + + /* + * Specifies the time at which the Compute Fleet is created. + */ + private OffsetDateTime timeCreated; + + /* + * Specifies the ID which uniquely identifies a Compute Fleet. + */ + private String uniqueId; + + /** + * Creates an instance of FleetProperties class. + */ + public FleetProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet. + * + * @return the spotPriorityProfile value. + */ + public SpotPriorityProfile spotPriorityProfile() { + return this.spotPriorityProfile; + } + + /** + * Set the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet. + * + * @param spotPriorityProfile the spotPriorityProfile value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withSpotPriorityProfile(SpotPriorityProfile spotPriorityProfile) { + this.spotPriorityProfile = spotPriorityProfile; + return this; + } + + /** + * Get the regularPriorityProfile property: Configuration Options for Regular instances in Compute Fleet. + * + * @return the regularPriorityProfile value. + */ + public RegularPriorityProfile regularPriorityProfile() { + return this.regularPriorityProfile; + } + + /** + * Set the regularPriorityProfile property: Configuration Options for Regular instances in Compute Fleet. + * + * @param regularPriorityProfile the regularPriorityProfile value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withRegularPriorityProfile(RegularPriorityProfile regularPriorityProfile) { + this.regularPriorityProfile = regularPriorityProfile; + return this; + } + + /** + * Get the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @return the vmSizesProfile value. + */ + public List vmSizesProfile() { + return this.vmSizesProfile; + } + + /** + * Set the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @param vmSizesProfile the vmSizesProfile value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withVmSizesProfile(List vmSizesProfile) { + this.vmSizesProfile = vmSizesProfile; + return this; + } + + /** + * Get the vmAttributes property: Attribute based Fleet. + * + * @return the vmAttributes value. + */ + public VMAttributes vmAttributes() { + return this.vmAttributes; + } + + /** + * Set the vmAttributes property: Attribute based Fleet. + * + * @param vmAttributes the vmAttributes value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withVmAttributes(VMAttributes vmAttributes) { + this.vmAttributes = vmAttributes; + return this; + } + + /** + * Get the additionalLocationsProfile property: Represents the configuration for additional locations where Fleet + * resources may be deployed. + * + * @return the additionalLocationsProfile value. + */ + public AdditionalLocationsProfile additionalLocationsProfile() { + return this.additionalLocationsProfile; + } + + /** + * Set the additionalLocationsProfile property: Represents the configuration for additional locations where Fleet + * resources may be deployed. + * + * @param additionalLocationsProfile the additionalLocationsProfile value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withAdditionalLocationsProfile(AdditionalLocationsProfile additionalLocationsProfile) { + this.additionalLocationsProfile = additionalLocationsProfile; + return this; + } + + /** + * Get the computeProfile property: Compute Profile to use for running user's workloads. + * + * @return the computeProfile value. + */ + public ComputeProfile computeProfile() { + return this.computeProfile; + } + + /** + * Set the computeProfile property: Compute Profile to use for running user's workloads. + * + * @param computeProfile the computeProfile value to set. + * @return the FleetProperties object itself. + */ + public FleetProperties withComputeProfile(ComputeProfile computeProfile) { + this.computeProfile = computeProfile; + return this; + } + + /** + * Get the timeCreated property: Specifies the time at which the Compute Fleet is created. + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Get the uniqueId property: Specifies the ID which uniquely identifies a Compute Fleet. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (spotPriorityProfile() != null) { + spotPriorityProfile().validate(); + } + if (regularPriorityProfile() != null) { + regularPriorityProfile().validate(); + } + if (vmSizesProfile() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property vmSizesProfile in model FleetProperties")); + } else { + vmSizesProfile().forEach(e -> e.validate()); + } + if (vmAttributes() != null) { + vmAttributes().validate(); + } + if (additionalLocationsProfile() != null) { + additionalLocationsProfile().validate(); + } + if (computeProfile() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property computeProfile in model FleetProperties")); + } else { + computeProfile().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FleetProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("vmSizesProfile", this.vmSizesProfile, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("computeProfile", this.computeProfile); + jsonWriter.writeJsonField("spotPriorityProfile", this.spotPriorityProfile); + jsonWriter.writeJsonField("regularPriorityProfile", this.regularPriorityProfile); + jsonWriter.writeJsonField("vmAttributes", this.vmAttributes); + jsonWriter.writeJsonField("additionalLocationsProfile", this.additionalLocationsProfile); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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 ("vmSizesProfile".equals(fieldName)) { + List vmSizesProfile = reader.readArray(reader1 -> VmSizeProfile.fromJson(reader1)); + deserializedFleetProperties.vmSizesProfile = vmSizesProfile; + } else if ("computeProfile".equals(fieldName)) { + deserializedFleetProperties.computeProfile = ComputeProfile.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedFleetProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("spotPriorityProfile".equals(fieldName)) { + deserializedFleetProperties.spotPriorityProfile = SpotPriorityProfile.fromJson(reader); + } else if ("regularPriorityProfile".equals(fieldName)) { + deserializedFleetProperties.regularPriorityProfile = RegularPriorityProfile.fromJson(reader); + } else if ("vmAttributes".equals(fieldName)) { + deserializedFleetProperties.vmAttributes = VMAttributes.fromJson(reader); + } else if ("additionalLocationsProfile".equals(fieldName)) { + deserializedFleetProperties.additionalLocationsProfile + = AdditionalLocationsProfile.fromJson(reader); + } else if ("timeCreated".equals(fieldName)) { + deserializedFleetProperties.timeCreated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("uniqueId".equals(fieldName)) { + deserializedFleetProperties.uniqueId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/OperationInner.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..ce1239a1b8d99 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurefleet.models.ActionType; +import com.azure.resourcemanager.azurefleet.models.OperationDisplay; +import com.azure.resourcemanager.azurefleet.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/VirtualMachineScaleSetInner.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/VirtualMachineScaleSetInner.java new file mode 100644 index 0000000000000..b165c548557b6 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/VirtualMachineScaleSetInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.models.ApiError; +import com.azure.resourcemanager.azurefleet.models.ProvisioningState; +import java.io.IOException; + +/** + * An AzureFleet's virtualMachineScaleSet. + */ +@Immutable +public final class VirtualMachineScaleSetInner implements JsonSerializable { + /* + * The name of the virtualMachineScaleSet + */ + private String name; + + /* + * The compute RP resource id of the virtualMachineScaleSet + * "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}" + */ + private String id; + + /* + * Type of the virtualMachineScaleSet + */ + private String type; + + /* + * This represents the operationStatus of the VMSS in response to the last operation that was performed on it by + * Azure Fleet resource. + */ + private ProvisioningState operationStatus; + + /* + * Error Information when `operationStatus` is `Failed` + */ + private ApiError error; + + /** + * Creates an instance of VirtualMachineScaleSetInner class. + */ + public VirtualMachineScaleSetInner() { + } + + /** + * Get the name property: The name of the virtualMachineScaleSet. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the id property: The compute RP resource id of the virtualMachineScaleSet + * "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}". + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Type of the virtualMachineScaleSet. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the operationStatus property: This represents the operationStatus of the VMSS in response to the last + * operation that was performed on it by Azure Fleet resource. + * + * @return the operationStatus value. + */ + public ProvisioningState operationStatus() { + return this.operationStatus; + } + + /** + * Get the error property: Error Information when `operationStatus` is `Failed`. + * + * @return the error value. + */ + public ApiError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetInner 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 VirtualMachineScaleSetInner. + */ + public static VirtualMachineScaleSetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetInner deserializedVirtualMachineScaleSetInner = new VirtualMachineScaleSetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetInner.name = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedVirtualMachineScaleSetInner.id = reader.getString(); + } else if ("operationStatus".equals(fieldName)) { + deserializedVirtualMachineScaleSetInner.operationStatus + = ProvisioningState.fromString(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedVirtualMachineScaleSetInner.type = reader.getString(); + } else if ("error".equals(fieldName)) { + deserializedVirtualMachineScaleSetInner.error = ApiError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetInner; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/package-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/package-info.java new file mode 100644 index 0000000000000..34ccfc630ff35 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for MicrosoftAzureFleet. + * null. + */ +package com.azure.resourcemanager.azurefleet.fluent.models; diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/package-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/package-info.java new file mode 100644 index 0000000000000..2b1da72465e89 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for MicrosoftAzureFleet. + * null. + */ +package com.azure.resourcemanager.azurefleet.fluent; diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetImpl.java new file mode 100644 index 0000000000000..e0448a61a90ea --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetProperties; +import com.azure.resourcemanager.azurefleet.models.AdditionalLocationsProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.Fleet; +import com.azure.resourcemanager.azurefleet.models.FleetUpdate; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityUpdate; +import com.azure.resourcemanager.azurefleet.models.Plan; +import com.azure.resourcemanager.azurefleet.models.ProvisioningState; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.ResourcePlanUpdate; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.VMAttributes; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class FleetImpl implements Fleet, Fleet.Definition, Fleet.Update { + private FleetInner innerObject; + + private final com.azure.resourcemanager.azurefleet.AzurefleetManager 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 List zones() { + List inner = this.innerModel().zones(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public SpotPriorityProfile spotPriorityProfile() { + return this.innerModel().spotPriorityProfile(); + } + + public RegularPriorityProfile regularPriorityProfile() { + return this.innerModel().regularPriorityProfile(); + } + + public List vmSizesProfile() { + List inner = this.innerModel().vmSizesProfile(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VMAttributes vmAttributes() { + return this.innerModel().vmAttributes(); + } + + public AdditionalLocationsProfile additionalLocationsProfile() { + return this.innerModel().additionalLocationsProfile(); + } + + public ComputeProfile computeProfile() { + return this.innerModel().computeProfile(); + } + + public OffsetDateTime timeCreated() { + return this.innerModel().timeCreated(); + } + + public String uniqueId() { + return this.innerModel().uniqueId(); + } + + 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.azurefleet.AzurefleetManager 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.azurefleet.AzurefleetManager 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.azurefleet.AzurefleetManager 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 withZones(List zones) { + this.innerModel().withZones(zones); + return this; + } + + public FleetImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public FleetImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public FleetImpl withSpotPriorityProfile(SpotPriorityProfile spotPriorityProfile) { + this.innerModel().withSpotPriorityProfile(spotPriorityProfile); + return this; + } + + public FleetImpl withRegularPriorityProfile(RegularPriorityProfile regularPriorityProfile) { + this.innerModel().withRegularPriorityProfile(regularPriorityProfile); + return this; + } + + public FleetImpl withVmSizesProfile(List vmSizesProfile) { + this.innerModel().withVmSizesProfile(vmSizesProfile); + return this; + } + + public FleetImpl withVmAttributes(VMAttributes vmAttributes) { + this.innerModel().withVmAttributes(vmAttributes); + return this; + } + + public FleetImpl withAdditionalLocationsProfile(AdditionalLocationsProfile additionalLocationsProfile) { + this.innerModel().withAdditionalLocationsProfile(additionalLocationsProfile); + return this; + } + + public FleetImpl withComputeProfile(ComputeProfile computeProfile) { + this.innerModel().withComputeProfile(computeProfile); + return this; + } + + public FleetImpl withIdentity(ManagedServiceIdentityUpdate identity) { + this.updateProperties.withIdentity(identity); + return this; + } + + public FleetImpl withPlan(ResourcePlanUpdate plan) { + this.updateProperties.withPlan(plan); + return this; + } + + public FleetImpl withProperties(FleetProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsClientImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsClientImpl.java new file mode 100644 index 0000000000000..6b8e9ae3fcfc0 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsClientImpl.java @@ -0,0 +1,1482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.FleetsClient; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.azurefleet.models.FleetListResult; +import com.azure.resourcemanager.azurefleet.models.FleetUpdate; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetListResult; +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 MicrosoftAzureFleetImpl client; + + /** + * Initializes an instance of FleetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FleetsClientImpl(MicrosoftAzureFleetImpl client) { + this.service = RestProxy.create(FleetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftAzureFleetFleets to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftAzureFleetF") + public interface FleetsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureFleet/fleets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @BodyParam("application/json") FleetInner resource, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @BodyParam("application/json") FleetUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{fleetName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("fleetName") String fleetName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureFleet/fleets/{name}/virtualMachineScaleSets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVirtualMachineScaleSets( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVirtualMachineScaleSetsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List Fleet resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation 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())); + } + + /** + * List Fleet resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation 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)); + } + + /** + * List Fleet resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Fleet resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Fleet resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Fleet resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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, 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 Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 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())); + } + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 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); + } + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 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())); + } + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, fleetName, context).block(); + } + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner getByResourceGroup(String resourceGroupName, String fleetName) { + return getByResourceGroupWithResponse(resourceGroupName, fleetName, Context.NONE).getValue(); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource 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 accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, resource, accept, context); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Compute Fleet resource. + */ + @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()); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Compute Fleet resource. + */ + @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); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginCreateOrUpdate(String resourceGroupName, + String fleetName, FleetInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, fleetName, resource).getSyncPoller(); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Compute Fleet resource. + */ + @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(); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource 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); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource 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); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource) { + return createOrUpdateAsync(resourceGroupName, fleetName, resource).block(); + } + + /** + * Create a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner createOrUpdate(String resourceGroupName, String fleetName, FleetInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, fleetName, resource, context).block(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, fleetName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource 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 accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, fleetName, properties, accept, context); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @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()); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @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); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FleetInner> beginUpdate(String resourceGroupName, String fleetName, + FleetUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, fleetName, properties).getSyncPoller(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @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(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource 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); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource 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); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties) { + return updateAsync(resourceGroupName, fleetName, properties).block(); + } + + /** + * Update a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute Fleet. + * @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 an Compute Fleet resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FleetInner update(String resourceGroupName, String fleetName, FleetUpdate properties, Context context) { + return updateAsync(resourceGroupName, fleetName, properties, context).block(); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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())); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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()); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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(); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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(); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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(); + } + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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(); + } + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 VirtualMachineScaleSet list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVirtualMachineScaleSetsSinglePageAsync(String resourceGroupName, String name) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVirtualMachineScaleSets(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, name, 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 VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 response of a VirtualMachineScaleSet list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVirtualMachineScaleSetsSinglePageAsync(String resourceGroupName, String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listVirtualMachineScaleSets(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, name, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 VirtualMachineScaleSet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listVirtualMachineScaleSetsAsync(String resourceGroupName, + String name) { + return new PagedFlux<>(() -> listVirtualMachineScaleSetsSinglePageAsync(resourceGroupName, name), + nextLink -> listVirtualMachineScaleSetsNextSinglePageAsync(nextLink)); + } + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listVirtualMachineScaleSetsAsync(String resourceGroupName, + String name, Context context) { + return new PagedFlux<>(() -> listVirtualMachineScaleSetsSinglePageAsync(resourceGroupName, name, context), + nextLink -> listVirtualMachineScaleSetsNextSinglePageAsync(nextLink, context)); + } + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVirtualMachineScaleSets(String resourceGroupName, + String name) { + return new PagedIterable<>(listVirtualMachineScaleSetsAsync(resourceGroupName, name)); + } + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name, + Context context) { + return new PagedIterable<>(listVirtualMachineScaleSetsAsync(resourceGroupName, name, 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> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 VirtualMachineScaleSet list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVirtualMachineScaleSetsNextSinglePageAsync(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.listVirtualMachineScaleSetsNext(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 VirtualMachineScaleSet list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listVirtualMachineScaleSetsNextSinglePageAsync(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.listVirtualMachineScaleSetsNext(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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsImpl.java new file mode 100644 index 0000000000000..b0a4f9d8df9c1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/FleetsImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.FleetsClient; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.azurefleet.models.Fleet; +import com.azure.resourcemanager.azurefleet.models.Fleets; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSet; + +public final class FleetsImpl implements Fleets { + private static final ClientLogger LOGGER = new ClientLogger(FleetsImpl.class); + + private final FleetsClient innerClient; + + private final com.azure.resourcemanager.azurefleet.AzurefleetManager serviceManager; + + public FleetsImpl(FleetsClient innerClient, com.azure.resourcemanager.azurefleet.AzurefleetManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FleetImpl(inner1, this.manager())); + } + + 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 listVirtualMachineScaleSets(String resourceGroupName, String name) { + PagedIterable inner + = this.serviceClient().listVirtualMachineScaleSets(resourceGroupName, name); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(inner1, this.manager())); + } + + public PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name, + Context context) { + PagedIterable inner + = this.serviceClient().listVirtualMachineScaleSets(resourceGroupName, name, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualMachineScaleSetImpl(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.azurefleet.AzurefleetManager manager() { + return this.serviceManager; + } + + public FleetImpl define(String name) { + return new FleetImpl(name, this.manager()); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetBuilder.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetBuilder.java new file mode 100644 index 0000000000000..95626582663e3 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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 MicrosoftAzureFleetImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftAzureFleetImpl.class }) +public final class MicrosoftAzureFleetBuilder { + /* + * 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 MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder 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 MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder 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 MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder 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 MicrosoftAzureFleetBuilder. + */ + public MicrosoftAzureFleetBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftAzureFleetImpl with the provided parameters. + * + * @return an instance of MicrosoftAzureFleetImpl. + */ + public MicrosoftAzureFleetImpl 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(); + MicrosoftAzureFleetImpl client = new MicrosoftAzureFleetImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetImpl.java new file mode 100644 index 0000000000000..1cd691c963955 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/MicrosoftAzureFleetImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.FleetsClient; +import com.azure.resourcemanager.azurefleet.fluent.MicrosoftAzureFleet; +import com.azure.resourcemanager.azurefleet.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 MicrosoftAzureFleetImpl type. + */ +@ServiceClient(builder = MicrosoftAzureFleetBuilder.class) +public final class MicrosoftAzureFleetImpl implements MicrosoftAzureFleet { + /** + * 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; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The 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 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; + } + + /** + * Initializes an instance of MicrosoftAzureFleet client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + MicrosoftAzureFleetImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-11-01"; + this.operations = new OperationsClientImpl(this); + this.fleets = new FleetsClientImpl(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(MicrosoftAzureFleetImpl.class); +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationImpl.java new file mode 100644 index 0000000000000..4662a3a725483 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.implementation; + +import com.azure.resourcemanager.azurefleet.fluent.models.OperationInner; +import com.azure.resourcemanager.azurefleet.models.ActionType; +import com.azure.resourcemanager.azurefleet.models.Operation; +import com.azure.resourcemanager.azurefleet.models.OperationDisplay; +import com.azure.resourcemanager.azurefleet.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.azurefleet.AzurefleetManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.azurefleet.AzurefleetManager 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.azurefleet.AzurefleetManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsClientImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..db6f17d7dc4d0 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.OperationsClient; +import com.azure.resourcemanager.azurefleet.fluent.models.OperationInner; +import com.azure.resourcemanager.azurefleet.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 MicrosoftAzureFleetImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftAzureFleetImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftAzureFleetOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftAzureFleetO") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.AzureFleet/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..37b1cbc23f99b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.OperationsClient; +import com.azure.resourcemanager.azurefleet.fluent.models.OperationInner; +import com.azure.resourcemanager.azurefleet.models.Operation; +import com.azure.resourcemanager.azurefleet.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.azurefleet.AzurefleetManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.azurefleet.AzurefleetManager 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.azurefleet.AzurefleetManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/ResourceManagerUtils.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..26ff8f2a7e794 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/VirtualMachineScaleSetImpl.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/VirtualMachineScaleSetImpl.java new file mode 100644 index 0000000000000..875a339a2be6b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/VirtualMachineScaleSetImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.implementation; + +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.azurefleet.models.ApiError; +import com.azure.resourcemanager.azurefleet.models.ProvisioningState; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSet; + +public final class VirtualMachineScaleSetImpl implements VirtualMachineScaleSet { + private VirtualMachineScaleSetInner innerObject; + + private final com.azure.resourcemanager.azurefleet.AzurefleetManager serviceManager; + + VirtualMachineScaleSetImpl(VirtualMachineScaleSetInner innerObject, + com.azure.resourcemanager.azurefleet.AzurefleetManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public ProvisioningState operationStatus() { + return this.innerModel().operationStatus(); + } + + public ApiError error() { + return this.innerModel().error(); + } + + public VirtualMachineScaleSetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurefleet.AzurefleetManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/package-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/package-info.java new file mode 100644 index 0000000000000..c545dd3435363 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for MicrosoftAzureFleet. + * null. + */ +package com.azure.resourcemanager.azurefleet.implementation; diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorManufacturer.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorManufacturer.java new file mode 100644 index 0000000000000..8e4549eb7c843 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorManufacturer.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Accelerator manufacturers supported by Azure VMs. + */ +public final class AcceleratorManufacturer extends ExpandableStringEnum { + /** + * Static value AMD for AcceleratorManufacturer. + */ + public static final AcceleratorManufacturer AMD = fromString("AMD"); + + /** + * Static value Nvidia for AcceleratorManufacturer. + */ + public static final AcceleratorManufacturer NVIDIA = fromString("Nvidia"); + + /** + * Static value Xilinx for AcceleratorManufacturer. + */ + public static final AcceleratorManufacturer XILINX = fromString("Xilinx"); + + /** + * Creates a new instance of AcceleratorManufacturer value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AcceleratorManufacturer() { + } + + /** + * Creates or finds a AcceleratorManufacturer from its string representation. + * + * @param name a name to look for. + * @return the corresponding AcceleratorManufacturer. + */ + public static AcceleratorManufacturer fromString(String name) { + return fromString(name, AcceleratorManufacturer.class); + } + + /** + * Gets known AcceleratorManufacturer values. + * + * @return known AcceleratorManufacturer values. + */ + public static Collection values() { + return values(AcceleratorManufacturer.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorType.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorType.java new file mode 100644 index 0000000000000..ad4d9552de446 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AcceleratorType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Accelerator types supported by Azure VMs. + */ +public final class AcceleratorType extends ExpandableStringEnum { + /** + * Static value GPU for AcceleratorType. + */ + public static final AcceleratorType GPU = fromString("GPU"); + + /** + * Static value FPGA for AcceleratorType. + */ + public static final AcceleratorType FPGA = fromString("FPGA"); + + /** + * Creates a new instance of AcceleratorType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AcceleratorType() { + } + + /** + * Creates or finds a AcceleratorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AcceleratorType. + */ + public static AcceleratorType fromString(String name) { + return fromString(name, AcceleratorType.class); + } + + /** + * Gets known AcceleratorType values. + * + * @return known AcceleratorType values. + */ + public static Collection values() { + return values(AcceleratorType.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ActionType.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ActionType.java new file mode 100644 index 0000000000000..1e0c57addc0ab --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalCapabilities.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalCapabilities.java new file mode 100644 index 0000000000000..ecdc3c0cb29b5 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalCapabilities.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * AdditionalCapabilities for VM. + */ +@Fluent +public final class AdditionalCapabilities implements JsonSerializable { + /* + * The flag that enables or disables a capability to have one or more managed data disks with UltraSSD_LRS storage + * account type on the VM or VMSS. + * Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale + * set only if this property is enabled. + */ + private Boolean ultraSsdEnabled; + + /* + * The flag that enables or disables hibernation capability on the VM. + */ + private Boolean hibernationEnabled; + + /** + * Creates an instance of AdditionalCapabilities class. + */ + public AdditionalCapabilities() { + } + + /** + * Get the ultraSsdEnabled property: The flag that enables or disables a capability to have one or more managed data + * disks with UltraSSD_LRS storage account type on the VM or VMSS. + * Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale + * set only if this property is enabled. + * + * @return the ultraSsdEnabled value. + */ + public Boolean ultraSsdEnabled() { + return this.ultraSsdEnabled; + } + + /** + * Set the ultraSsdEnabled property: The flag that enables or disables a capability to have one or more managed data + * disks with UltraSSD_LRS storage account type on the VM or VMSS. + * Managed disks with storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale + * set only if this property is enabled. + * + * @param ultraSsdEnabled the ultraSsdEnabled value to set. + * @return the AdditionalCapabilities object itself. + */ + public AdditionalCapabilities withUltraSsdEnabled(Boolean ultraSsdEnabled) { + this.ultraSsdEnabled = ultraSsdEnabled; + return this; + } + + /** + * Get the hibernationEnabled property: The flag that enables or disables hibernation capability on the VM. + * + * @return the hibernationEnabled value. + */ + public Boolean hibernationEnabled() { + return this.hibernationEnabled; + } + + /** + * Set the hibernationEnabled property: The flag that enables or disables hibernation capability on the VM. + * + * @param hibernationEnabled the hibernationEnabled value to set. + * @return the AdditionalCapabilities object itself. + */ + public AdditionalCapabilities withHibernationEnabled(Boolean hibernationEnabled) { + this.hibernationEnabled = hibernationEnabled; + 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.writeBooleanField("ultraSSDEnabled", this.ultraSsdEnabled); + jsonWriter.writeBooleanField("hibernationEnabled", this.hibernationEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalCapabilities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalCapabilities 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 AdditionalCapabilities. + */ + public static AdditionalCapabilities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalCapabilities deserializedAdditionalCapabilities = new AdditionalCapabilities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ultraSSDEnabled".equals(fieldName)) { + deserializedAdditionalCapabilities.ultraSsdEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("hibernationEnabled".equals(fieldName)) { + deserializedAdditionalCapabilities.hibernationEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalCapabilities; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalLocationsProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalLocationsProfile.java new file mode 100644 index 0000000000000..f14fabbc02d23 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalLocationsProfile.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; +import java.util.List; + +/** + * Represents the configuration for additional locations where Fleet resources may be deployed. + */ +@Fluent +public final class AdditionalLocationsProfile implements JsonSerializable { + /* + * The list of location profiles. + */ + private List locationProfiles; + + /** + * Creates an instance of AdditionalLocationsProfile class. + */ + public AdditionalLocationsProfile() { + } + + /** + * Get the locationProfiles property: The list of location profiles. + * + * @return the locationProfiles value. + */ + public List locationProfiles() { + return this.locationProfiles; + } + + /** + * Set the locationProfiles property: The list of location profiles. + * + * @param locationProfiles the locationProfiles value to set. + * @return the AdditionalLocationsProfile object itself. + */ + public AdditionalLocationsProfile withLocationProfiles(List locationProfiles) { + this.locationProfiles = locationProfiles; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locationProfiles() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property locationProfiles in model AdditionalLocationsProfile")); + } else { + locationProfiles().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdditionalLocationsProfile.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("locationProfiles", this.locationProfiles, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalLocationsProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalLocationsProfile 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 AdditionalLocationsProfile. + */ + public static AdditionalLocationsProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalLocationsProfile deserializedAdditionalLocationsProfile = new AdditionalLocationsProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("locationProfiles".equals(fieldName)) { + List locationProfiles + = reader.readArray(reader1 -> LocationProfile.fromJson(reader1)); + deserializedAdditionalLocationsProfile.locationProfiles = locationProfiles; + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalLocationsProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContent.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContent.java new file mode 100644 index 0000000000000..3801d300128bf --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContent.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies additional XML formatted information that can be included in the + * Unattend.xml file, which is used by Windows Setup. Contents are defined by + * setting name, component name, and the pass in which the content is applied. + */ +@Fluent +public final class AdditionalUnattendContent implements JsonSerializable { + /* + * The pass name. Currently, the only allowable value is OobeSystem. + */ + private AdditionalUnattendContentPassName passName; + + /* + * The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + */ + private AdditionalUnattendContentComponentName componentName; + + /* + * Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + */ + private SettingNames settingName; + + /* + * Specifies the XML formatted content that is added to the unattend.xml file for + * the specified path and component. The XML must be less than 4KB and must + * include the root element for the setting or feature that is being inserted. + */ + private String content; + + /** + * Creates an instance of AdditionalUnattendContent class. + */ + public AdditionalUnattendContent() { + } + + /** + * Get the passName property: The pass name. Currently, the only allowable value is OobeSystem. + * + * @return the passName value. + */ + public AdditionalUnattendContentPassName passName() { + return this.passName; + } + + /** + * Set the passName property: The pass name. Currently, the only allowable value is OobeSystem. + * + * @param passName the passName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withPassName(AdditionalUnattendContentPassName passName) { + this.passName = passName; + return this; + } + + /** + * Get the componentName property: The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + * + * @return the componentName value. + */ + public AdditionalUnattendContentComponentName componentName() { + return this.componentName; + } + + /** + * Set the componentName property: The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + * + * @param componentName the componentName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withComponentName(AdditionalUnattendContentComponentName componentName) { + this.componentName = componentName; + return this; + } + + /** + * Get the settingName property: Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + * + * @return the settingName value. + */ + public SettingNames settingName() { + return this.settingName; + } + + /** + * Set the settingName property: Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + * + * @param settingName the settingName value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withSettingName(SettingNames settingName) { + this.settingName = settingName; + return this; + } + + /** + * Get the content property: Specifies the XML formatted content that is added to the unattend.xml file for + * the specified path and component. The XML must be less than 4KB and must + * include the root element for the setting or feature that is being inserted. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: Specifies the XML formatted content that is added to the unattend.xml file for + * the specified path and component. The XML must be less than 4KB and must + * include the root element for the setting or feature that is being inserted. + * + * @param content the content value to set. + * @return the AdditionalUnattendContent object itself. + */ + public AdditionalUnattendContent withContent(String content) { + this.content = content; + 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("passName", this.passName == null ? null : this.passName.toString()); + jsonWriter.writeStringField("componentName", this.componentName == null ? null : this.componentName.toString()); + jsonWriter.writeStringField("settingName", this.settingName == null ? null : this.settingName.toString()); + jsonWriter.writeStringField("content", this.content); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalUnattendContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalUnattendContent 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 AdditionalUnattendContent. + */ + public static AdditionalUnattendContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalUnattendContent deserializedAdditionalUnattendContent = new AdditionalUnattendContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("passName".equals(fieldName)) { + deserializedAdditionalUnattendContent.passName + = AdditionalUnattendContentPassName.fromString(reader.getString()); + } else if ("componentName".equals(fieldName)) { + deserializedAdditionalUnattendContent.componentName + = AdditionalUnattendContentComponentName.fromString(reader.getString()); + } else if ("settingName".equals(fieldName)) { + deserializedAdditionalUnattendContent.settingName = SettingNames.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + deserializedAdditionalUnattendContent.content = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalUnattendContent; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentComponentName.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentComponentName.java new file mode 100644 index 0000000000000..4ee0029d8d966 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentComponentName.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +/** + * The component name. Currently, the only allowable value is + * Microsoft-Windows-Shell-Setup. + */ +public enum AdditionalUnattendContentComponentName { + /** + * Enum value Microsoft-Windows-Shell-Setup. + */ + MICROSOFT_WINDOWS_SHELL_SETUP("Microsoft-Windows-Shell-Setup"); + + /** + * The actual serialized value for a AdditionalUnattendContentComponentName instance. + */ + private final String value; + + AdditionalUnattendContentComponentName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdditionalUnattendContentComponentName instance. + * + * @param value the serialized value to parse. + * @return the parsed AdditionalUnattendContentComponentName object, or null if unable to parse. + */ + public static AdditionalUnattendContentComponentName fromString(String value) { + if (value == null) { + return null; + } + AdditionalUnattendContentComponentName[] items = AdditionalUnattendContentComponentName.values(); + for (AdditionalUnattendContentComponentName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentPassName.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentPassName.java new file mode 100644 index 0000000000000..2544735eb2b6c --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/AdditionalUnattendContentPassName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +/** + * The pass name. Currently, the only allowable value is OobeSystem. + */ +public enum AdditionalUnattendContentPassName { + /** + * Enum value OobeSystem. + */ + OOBE_SYSTEM("OobeSystem"); + + /** + * The actual serialized value for a AdditionalUnattendContentPassName instance. + */ + private final String value; + + AdditionalUnattendContentPassName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdditionalUnattendContentPassName instance. + * + * @param value the serialized value to parse. + * @return the parsed AdditionalUnattendContentPassName object, or null if unable to parse. + */ + public static AdditionalUnattendContentPassName fromString(String value) { + if (value == null) { + return null; + } + AdditionalUnattendContentPassName[] items = AdditionalUnattendContentPassName.values(); + for (AdditionalUnattendContentPassName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiEntityReference.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiEntityReference.java new file mode 100644 index 0000000000000..10d856c1faaef --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiEntityReference.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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 API entity reference. + */ +@Fluent +public final class ApiEntityReference implements JsonSerializable { + /* + * The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + */ + private String id; + + /** + * Creates an instance of ApiEntityReference class. + */ + public ApiEntityReference() { + } + + /** + * Get the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM resource id in the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + * + * @param id the id value to set. + * @return the ApiEntityReference object itself. + */ + public ApiEntityReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiEntityReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiEntityReference 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 ApiEntityReference. + */ + public static ApiEntityReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiEntityReference deserializedApiEntityReference = new ApiEntityReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedApiEntityReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApiEntityReference; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiError.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiError.java new file mode 100644 index 0000000000000..f2e290f067f9d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiError.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * ApiError for Fleet. + */ +@Fluent +public final class ApiError implements JsonSerializable { + /* + * The error code. + */ + private String code; + + /* + * The target of the particular error. + */ + private String target; + + /* + * The error message. + */ + private String message; + + /* + * The API error details + */ + private List details; + + /* + * The API inner error + */ + private InnerError innererror; + + /** + * Creates an instance of ApiError class. + */ + public ApiError() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The error code. + * + * @param code the code value to set. + * @return the ApiError object itself. + */ + public ApiError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the target property: The target of the particular error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The target of the particular error. + * + * @param target the target value to set. + * @return the ApiError object itself. + */ + public ApiError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The error message. + * + * @param message the message value to set. + * @return the ApiError object itself. + */ + public ApiError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: The API error details. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: The API error details. + * + * @param details the details value to set. + * @return the ApiError object itself. + */ + public ApiError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get the innererror property: The API inner error. + * + * @return the innererror value. + */ + public InnerError innererror() { + return this.innererror; + } + + /** + * Set the innererror property: The API inner error. + * + * @param innererror the innererror value to set. + * @return the ApiError object itself. + */ + public ApiError withInnererror(InnerError innererror) { + this.innererror = innererror; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + if (innererror() != null) { + innererror().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeArrayField("details", this.details, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("innererror", this.innererror); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiError 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 ApiError. + */ + public static ApiError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiError deserializedApiError = new ApiError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedApiError.code = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedApiError.target = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedApiError.message = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> ApiErrorBase.fromJson(reader1)); + deserializedApiError.details = details; + } else if ("innererror".equals(fieldName)) { + deserializedApiError.innererror = InnerError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApiError; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiErrorBase.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiErrorBase.java new file mode 100644 index 0000000000000..322ab53decd30 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApiErrorBase.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * API error base. + */ +@Fluent +public final class ApiErrorBase implements JsonSerializable { + /* + * The error code. + */ + private String code; + + /* + * The target of the particular error. + */ + private String target; + + /* + * The error message. + */ + private String message; + + /** + * Creates an instance of ApiErrorBase class. + */ + public ApiErrorBase() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The error code. + * + * @param code the code value to set. + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the target property: The target of the particular error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The target of the particular error. + * + * @param target the target value to set. + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The error message. + * + * @param message the message value to set. + * @return the ApiErrorBase object itself. + */ + public ApiErrorBase withMessage(String message) { + this.message = message; + 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("code", this.code); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiErrorBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiErrorBase 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 ApiErrorBase. + */ + public static ApiErrorBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiErrorBase deserializedApiErrorBase = new ApiErrorBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedApiErrorBase.code = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedApiErrorBase.target = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedApiErrorBase.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApiErrorBase; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApplicationProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApplicationProfile.java new file mode 100644 index 0000000000000..4a9855c672e9d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ApplicationProfile.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Contains the list of gallery applications that should be made available to the + * VM/VMSS. + */ +@Fluent +public final class ApplicationProfile implements JsonSerializable { + /* + * Specifies the gallery applications that should be made available to the VM/VMSS + */ + private List galleryApplications; + + /** + * Creates an instance of ApplicationProfile class. + */ + public ApplicationProfile() { + } + + /** + * Get the galleryApplications property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the galleryApplications value. + */ + public List galleryApplications() { + return this.galleryApplications; + } + + /** + * Set the galleryApplications property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param galleryApplications the galleryApplications value to set. + * @return the ApplicationProfile object itself. + */ + public ApplicationProfile withGalleryApplications(List galleryApplications) { + this.galleryApplications = galleryApplications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (galleryApplications() != null) { + galleryApplications().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("galleryApplications", this.galleryApplications, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationProfile 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 ApplicationProfile. + */ + public static ApplicationProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationProfile deserializedApplicationProfile = new ApplicationProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("galleryApplications".equals(fieldName)) { + List galleryApplications + = reader.readArray(reader1 -> VMGalleryApplication.fromJson(reader1)); + deserializedApplicationProfile.galleryApplications = galleryApplications; + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ArchitectureType.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ArchitectureType.java new file mode 100644 index 0000000000000..528d18845afec --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ArchitectureType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Architecture types supported by Azure VMs. + */ +public final class ArchitectureType extends ExpandableStringEnum { + /** + * Static value ARM64 for ArchitectureType. + */ + public static final ArchitectureType ARM64 = fromString("ARM64"); + + /** + * Static value X64 for ArchitectureType. + */ + public static final ArchitectureType X64 = fromString("X64"); + + /** + * Creates a new instance of ArchitectureType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ArchitectureType() { + } + + /** + * Creates or finds a ArchitectureType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ArchitectureType. + */ + public static ArchitectureType fromString(String name) { + return fromString(name, ArchitectureType.class); + } + + /** + * Gets known ArchitectureType values. + * + * @return known ArchitectureType values. + */ + public static Collection values() { + return values(ArchitectureType.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BaseVirtualMachineProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BaseVirtualMachineProfile.java new file mode 100644 index 0000000000000..1f3fd322ebd06 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BaseVirtualMachineProfile.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the base virtual machine profile for fleet. + */ +@Fluent +public final class BaseVirtualMachineProfile implements JsonSerializable { + /* + * Specifies the operating system settings for the virtual machines in the scale + * set. + */ + private VirtualMachineScaleSetOSProfile osProfile; + + /* + * Specifies the storage settings for the virtual machine disks. + */ + private VirtualMachineScaleSetStorageProfile storageProfile; + + /* + * Specifies properties of the network interfaces of the virtual machines in the + * scale set. + */ + private VirtualMachineScaleSetNetworkProfile networkProfile; + + /* + * Specifies the Security related profile settings for the virtual machines in the + * scale set. + */ + private SecurityProfile securityProfile; + + /* + * Specifies the boot diagnostic settings state. + */ + private DiagnosticsProfile diagnosticsProfile; + + /* + * Specifies a collection of settings for extensions installed on virtual machines + * in the scale set. + */ + private VirtualMachineScaleSetExtensionProfile extensionProfile; + + /* + * Specifies that the image or disk that is being used was licensed on-premises. + *

Possible values for Windows Server operating system are:

+ * Windows_Client

Windows_Server

Possible values for Linux + * Server operating system are:

RHEL_BYOS (for RHEL)

SLES_BYOS + * (for SUSE)

For more information, see [Azure Hybrid Use Benefit for + * Windows + * Server](https://learn.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + *

[Azure Hybrid Use Benefit for Linux + * Server](https://learn.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + *

Minimum api-version: 2015-06-15 + */ + private String licenseType; + + /* + * Specifies Scheduled Event related configurations. + */ + private ScheduledEventsProfile scheduledEventsProfile; + + /* + * UserData for the virtual machines in the scale set, which must be base-64 + * encoded. Customer should not pass any secrets in here. Minimum api-version: + * 2021-03-01. + */ + private String userData; + + /* + * Specifies the capacity reservation related details of a scale set. Minimum + * api-version: 2021-04-01. + */ + private CapacityReservationProfile capacityReservation; + + /* + * Specifies the gallery applications that should be made available to the VM/VMSS + */ + private ApplicationProfile applicationProfile; + + /* + * Specifies the hardware profile related details of a scale set. Minimum + * api-version: 2021-11-01. + */ + private VirtualMachineScaleSetHardwareProfile hardwareProfile; + + /* + * Specifies the service artifact reference id used to set same image version for + * all virtual machines in the scale set when using 'latest' image version. + * Minimum api-version: 2022-11-01 + */ + private ServiceArtifactReference serviceArtifactReference; + + /* + * Specifies the security posture to be used for all virtual machines in the scale + * set. Minimum api-version: 2023-03-01 + */ + private SecurityPostureReference securityPostureReference; + + /* + * Specifies the time in which this VM profile for the Virtual Machine Scale Set + * was created. Minimum API version for this property is 2023-09-01. This value + * will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile + * with minimum api-version 2023-09-01. Examples: "2024-07-01T00:00:01.1234567+00:00" + */ + private OffsetDateTime timeCreated; + + /** + * Creates an instance of BaseVirtualMachineProfile class. + */ + public BaseVirtualMachineProfile() { + } + + /** + * Get the osProfile property: Specifies the operating system settings for the virtual machines in the scale + * set. + * + * @return the osProfile value. + */ + public VirtualMachineScaleSetOSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings for the virtual machines in the scale + * set. + * + * @param osProfile the osProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withOsProfile(VirtualMachineScaleSetOSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @return the storageProfile value. + */ + public VirtualMachineScaleSetStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the virtual machine disks. + * + * @param storageProfile the storageProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withStorageProfile(VirtualMachineScaleSetStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the networkProfile property: Specifies properties of the network interfaces of the virtual machines in the + * scale set. + * + * @return the networkProfile value. + */ + public VirtualMachineScaleSetNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Specifies properties of the network interfaces of the virtual machines in the + * scale set. + * + * @param networkProfile the networkProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withNetworkProfile(VirtualMachineScaleSetNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the securityProfile property: Specifies the Security related profile settings for the virtual machines in the + * scale set. + * + * @return the securityProfile value. + */ + public SecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the Security related profile settings for the virtual machines in the + * scale set. + * + * @param securityProfile the securityProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withSecurityProfile(SecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the diagnosticsProfile property: Specifies the boot diagnostic settings state. + * + * @return the diagnosticsProfile value. + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile property: Specifies the boot diagnostic settings state. + * + * @param diagnosticsProfile the diagnosticsProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the extensionProfile property: Specifies a collection of settings for extensions installed on virtual + * machines + * in the scale set. + * + * @return the extensionProfile value. + */ + public VirtualMachineScaleSetExtensionProfile extensionProfile() { + return this.extensionProfile; + } + + /** + * Set the extensionProfile property: Specifies a collection of settings for extensions installed on virtual + * machines + * in the scale set. + * + * @param extensionProfile the extensionProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withExtensionProfile(VirtualMachineScaleSetExtensionProfile extensionProfile) { + this.extensionProfile = extensionProfile; + return this; + } + + /** + * Get the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> + * Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux + * Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS + * (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for + * Windows + * Server](https://learn.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://learn.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: Specifies that the image or disk that is being used was licensed on-premises. + * <br><br> Possible values for Windows Server operating system are: <br><br> + * Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux + * Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS + * (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for + * Windows + * Server](https://learn.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + * <br><br> [Azure Hybrid Use Benefit for Linux + * Server](https://learn.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + * <br><br> Minimum api-version: 2015-06-15. + * + * @param licenseType the licenseType value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @return the scheduledEventsProfile value. + */ + public ScheduledEventsProfile scheduledEventsProfile() { + return this.scheduledEventsProfile; + } + + /** + * Set the scheduledEventsProfile property: Specifies Scheduled Event related configurations. + * + * @param scheduledEventsProfile the scheduledEventsProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withScheduledEventsProfile(ScheduledEventsProfile scheduledEventsProfile) { + this.scheduledEventsProfile = scheduledEventsProfile; + return this; + } + + /** + * Get the userData property: UserData for the virtual machines in the scale set, which must be base-64 + * encoded. Customer should not pass any secrets in here. Minimum api-version: + * 2021-03-01. + * + * @return the userData value. + */ + public String userData() { + return this.userData; + } + + /** + * Set the userData property: UserData for the virtual machines in the scale set, which must be base-64 + * encoded. Customer should not pass any secrets in here. Minimum api-version: + * 2021-03-01. + * + * @param userData the userData value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withUserData(String userData) { + this.userData = userData; + return this; + } + + /** + * Get the capacityReservation property: Specifies the capacity reservation related details of a scale set. Minimum + * api-version: 2021-04-01. + * + * @return the capacityReservation value. + */ + public CapacityReservationProfile capacityReservation() { + return this.capacityReservation; + } + + /** + * Set the capacityReservation property: Specifies the capacity reservation related details of a scale set. Minimum + * api-version: 2021-04-01. + * + * @param capacityReservation the capacityReservation value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withCapacityReservation(CapacityReservationProfile capacityReservation) { + this.capacityReservation = capacityReservation; + return this; + } + + /** + * Get the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @return the applicationProfile value. + */ + public ApplicationProfile applicationProfile() { + return this.applicationProfile; + } + + /** + * Set the applicationProfile property: Specifies the gallery applications that should be made available to the + * VM/VMSS. + * + * @param applicationProfile the applicationProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withApplicationProfile(ApplicationProfile applicationProfile) { + this.applicationProfile = applicationProfile; + return this; + } + + /** + * Get the hardwareProfile property: Specifies the hardware profile related details of a scale set. Minimum + * api-version: 2021-11-01. + * + * @return the hardwareProfile value. + */ + public VirtualMachineScaleSetHardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Specifies the hardware profile related details of a scale set. Minimum + * api-version: 2021-11-01. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withHardwareProfile(VirtualMachineScaleSetHardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the serviceArtifactReference property: Specifies the service artifact reference id used to set same image + * version for + * all virtual machines in the scale set when using 'latest' image version. + * Minimum api-version: 2022-11-01. + * + * @return the serviceArtifactReference value. + */ + public ServiceArtifactReference serviceArtifactReference() { + return this.serviceArtifactReference; + } + + /** + * Set the serviceArtifactReference property: Specifies the service artifact reference id used to set same image + * version for + * all virtual machines in the scale set when using 'latest' image version. + * Minimum api-version: 2022-11-01. + * + * @param serviceArtifactReference the serviceArtifactReference value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withServiceArtifactReference(ServiceArtifactReference serviceArtifactReference) { + this.serviceArtifactReference = serviceArtifactReference; + return this; + } + + /** + * Get the securityPostureReference property: Specifies the security posture to be used for all virtual machines in + * the scale + * set. Minimum api-version: 2023-03-01. + * + * @return the securityPostureReference value. + */ + public SecurityPostureReference securityPostureReference() { + return this.securityPostureReference; + } + + /** + * Set the securityPostureReference property: Specifies the security posture to be used for all virtual machines in + * the scale + * set. Minimum api-version: 2023-03-01. + * + * @param securityPostureReference the securityPostureReference value to set. + * @return the BaseVirtualMachineProfile object itself. + */ + public BaseVirtualMachineProfile withSecurityPostureReference(SecurityPostureReference securityPostureReference) { + this.securityPostureReference = securityPostureReference; + return this; + } + + /** + * Get the timeCreated property: Specifies the time in which this VM profile for the Virtual Machine Scale Set + * was created. Minimum API version for this property is 2023-09-01. This value + * will be added to VMSS Flex VM tags when creating/updating the VMSS VM Profile + * with minimum api-version 2023-09-01. Examples: "2024-07-01T00:00:01.1234567+00:00". + * + * @return the timeCreated value. + */ + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osProfile() != null) { + osProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (diagnosticsProfile() != null) { + diagnosticsProfile().validate(); + } + if (extensionProfile() != null) { + extensionProfile().validate(); + } + if (scheduledEventsProfile() != null) { + scheduledEventsProfile().validate(); + } + if (capacityReservation() != null) { + capacityReservation().validate(); + } + if (applicationProfile() != null) { + applicationProfile().validate(); + } + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (serviceArtifactReference() != null) { + serviceArtifactReference().validate(); + } + if (securityPostureReference() != null) { + securityPostureReference().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("osProfile", this.osProfile); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + jsonWriter.writeJsonField("networkProfile", this.networkProfile); + jsonWriter.writeJsonField("securityProfile", this.securityProfile); + jsonWriter.writeJsonField("diagnosticsProfile", this.diagnosticsProfile); + jsonWriter.writeJsonField("extensionProfile", this.extensionProfile); + jsonWriter.writeStringField("licenseType", this.licenseType); + jsonWriter.writeJsonField("scheduledEventsProfile", this.scheduledEventsProfile); + jsonWriter.writeStringField("userData", this.userData); + jsonWriter.writeJsonField("capacityReservation", this.capacityReservation); + jsonWriter.writeJsonField("applicationProfile", this.applicationProfile); + jsonWriter.writeJsonField("hardwareProfile", this.hardwareProfile); + jsonWriter.writeJsonField("serviceArtifactReference", this.serviceArtifactReference); + jsonWriter.writeJsonField("securityPostureReference", this.securityPostureReference); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaseVirtualMachineProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaseVirtualMachineProfile 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 BaseVirtualMachineProfile. + */ + public static BaseVirtualMachineProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BaseVirtualMachineProfile deserializedBaseVirtualMachineProfile = new BaseVirtualMachineProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("osProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.osProfile = VirtualMachineScaleSetOSProfile.fromJson(reader); + } else if ("storageProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.storageProfile + = VirtualMachineScaleSetStorageProfile.fromJson(reader); + } else if ("networkProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.networkProfile + = VirtualMachineScaleSetNetworkProfile.fromJson(reader); + } else if ("securityProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.securityProfile = SecurityProfile.fromJson(reader); + } else if ("diagnosticsProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.diagnosticsProfile = DiagnosticsProfile.fromJson(reader); + } else if ("extensionProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.extensionProfile + = VirtualMachineScaleSetExtensionProfile.fromJson(reader); + } else if ("licenseType".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.licenseType = reader.getString(); + } else if ("scheduledEventsProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.scheduledEventsProfile + = ScheduledEventsProfile.fromJson(reader); + } else if ("userData".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.userData = reader.getString(); + } else if ("capacityReservation".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.capacityReservation + = CapacityReservationProfile.fromJson(reader); + } else if ("applicationProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.applicationProfile = ApplicationProfile.fromJson(reader); + } else if ("hardwareProfile".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.hardwareProfile + = VirtualMachineScaleSetHardwareProfile.fromJson(reader); + } else if ("serviceArtifactReference".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.serviceArtifactReference + = ServiceArtifactReference.fromJson(reader); + } else if ("securityPostureReference".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.securityPostureReference + = SecurityPostureReference.fromJson(reader); + } else if ("timeCreated".equals(fieldName)) { + deserializedBaseVirtualMachineProfile.timeCreated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBaseVirtualMachineProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BootDiagnostics.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BootDiagnostics.java new file mode 100644 index 0000000000000..40cf1f4ac674a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/BootDiagnostics.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. You can easily view the output of your + * console log. Azure also enables you to see a screenshot of the VM from the + * hypervisor. + */ +@Fluent +public final class BootDiagnostics implements JsonSerializable { + /* + * Whether boot diagnostics should be enabled on the Virtual Machine. + */ + private Boolean enabled; + + /* + * Uri of the storage account to use for placing the console output and + * screenshot. If storageUri is not specified while enabling boot diagnostics, + * managed storage will be used. + */ + private String storageUri; + + /** + * Creates an instance of BootDiagnostics class. + */ + public BootDiagnostics() { + } + + /** + * Get the enabled property: Whether boot diagnostics should be enabled on the Virtual Machine. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Whether boot diagnostics should be enabled on the Virtual Machine. + * + * @param enabled the enabled value to set. + * @return the BootDiagnostics object itself. + */ + public BootDiagnostics withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the storageUri property: Uri of the storage account to use for placing the console output and + * screenshot. If storageUri is not specified while enabling boot diagnostics, + * managed storage will be used. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Uri of the storage account to use for placing the console output and + * screenshot. If storageUri is not specified while enabling boot diagnostics, + * managed storage will be used. + * + * @param storageUri the storageUri value to set. + * @return the BootDiagnostics object itself. + */ + public BootDiagnostics withStorageUri(String storageUri) { + this.storageUri = storageUri; + 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.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("storageUri", this.storageUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BootDiagnostics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BootDiagnostics 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 BootDiagnostics. + */ + public static BootDiagnostics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BootDiagnostics deserializedBootDiagnostics = new BootDiagnostics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedBootDiagnostics.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("storageUri".equals(fieldName)) { + deserializedBootDiagnostics.storageUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBootDiagnostics; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CachingTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CachingTypes.java new file mode 100644 index 0000000000000..f014468ba4147 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CachingTypes.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the caching requirements. + */ +public final class CachingTypes extends ExpandableStringEnum { + /** + * Static value None for CachingTypes. + */ + public static final CachingTypes NONE = fromString("None"); + + /** + * Static value ReadOnly for CachingTypes. + */ + public static final CachingTypes READ_ONLY = fromString("ReadOnly"); + + /** + * Static value ReadWrite for CachingTypes. + */ + public static final CachingTypes READ_WRITE = fromString("ReadWrite"); + + /** + * Creates a new instance of CachingTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CachingTypes() { + } + + /** + * Creates or finds a CachingTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding CachingTypes. + */ + public static CachingTypes fromString(String name) { + return fromString(name, CachingTypes.class); + } + + /** + * Gets known CachingTypes values. + * + * @return known CachingTypes values. + */ + public static Collection values() { + return values(CachingTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CapacityReservationProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CapacityReservationProfile.java new file mode 100644 index 0000000000000..fb58bf63afb5d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CapacityReservationProfile.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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 parameters of a capacity reservation Profile. + */ +@Fluent +public final class CapacityReservationProfile implements JsonSerializable { + /* + * Specifies the capacity reservation group resource id that should be used for + * allocating the virtual machine or scaleset vm instances provided enough + * capacity has been reserved. Please refer to https://aka.ms/CapacityReservation + * for more details. + */ + private SubResource capacityReservationGroup; + + /** + * Creates an instance of CapacityReservationProfile class. + */ + public CapacityReservationProfile() { + } + + /** + * Get the capacityReservationGroup property: Specifies the capacity reservation group resource id that should be + * used for + * allocating the virtual machine or scaleset vm instances provided enough + * capacity has been reserved. Please refer to https://aka.ms/CapacityReservation + * for more details. + * + * @return the capacityReservationGroup value. + */ + public SubResource capacityReservationGroup() { + return this.capacityReservationGroup; + } + + /** + * Set the capacityReservationGroup property: Specifies the capacity reservation group resource id that should be + * used for + * allocating the virtual machine or scaleset vm instances provided enough + * capacity has been reserved. Please refer to https://aka.ms/CapacityReservation + * for more details. + * + * @param capacityReservationGroup the capacityReservationGroup value to set. + * @return the CapacityReservationProfile object itself. + */ + public CapacityReservationProfile withCapacityReservationGroup(SubResource capacityReservationGroup) { + this.capacityReservationGroup = capacityReservationGroup; + 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.writeJsonField("capacityReservationGroup", this.capacityReservationGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapacityReservationProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapacityReservationProfile 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 CapacityReservationProfile. + */ + public static CapacityReservationProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapacityReservationProfile deserializedCapacityReservationProfile = new CapacityReservationProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("capacityReservationGroup".equals(fieldName)) { + deserializedCapacityReservationProfile.capacityReservationGroup = SubResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCapacityReservationProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ComputeProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ComputeProfile.java new file mode 100644 index 0000000000000..f65435f783b38 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ComputeProfile.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Compute Profile to use for running user's workloads. + */ +@Fluent +public final class ComputeProfile implements JsonSerializable { + /* + * Base Virtual Machine Profile Properties to be specified according to + * "specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/{computeApiVersion}/virtualMachineScaleSet.json#/definitions/VirtualMachineScaleSetVMProfile" + */ + private BaseVirtualMachineProfile baseVirtualMachineProfile; + + /* + * Specifies the Microsoft.Compute API version to use when creating underlying Virtual Machine scale sets and + * Virtual Machines. + * The default value will be the latest supported computeApiVersion by Compute Fleet. + */ + private String computeApiVersion; + + /* + * Specifies the number of fault domains to use when creating the underlying VMSS. + * A fault domain is a logical group of hardware within an Azure datacenter. + * VMs in the same fault domain share a common power source and network switch. + * If not specified, defaults to 1, which represents "Max Spreading" (using as many fault domains as possible). + * This property cannot be updated. + */ + private Integer platformFaultDomainCount; + + /* + * Specifies VMSS and VM API entity models support two additional capabilities as of today: ultraSSDEnabled and + * hibernationEnabled. + * ultraSSDEnabled: Enables UltraSSD_LRS storage account type on the VMSS VMs. + * hibernationEnabled: Enables the hibernation capability on the VMSS VMs. + * Default value is null if not specified. This property cannot be updated once set. + */ + private AdditionalCapabilities additionalVirtualMachineCapabilities; + + /** + * Creates an instance of ComputeProfile class. + */ + public ComputeProfile() { + } + + /** + * Get the baseVirtualMachineProfile property: Base Virtual Machine Profile Properties to be specified according to + * "specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/{computeApiVersion}/virtualMachineScaleSet.json#/definitions/VirtualMachineScaleSetVMProfile". + * + * @return the baseVirtualMachineProfile value. + */ + public BaseVirtualMachineProfile baseVirtualMachineProfile() { + return this.baseVirtualMachineProfile; + } + + /** + * Set the baseVirtualMachineProfile property: Base Virtual Machine Profile Properties to be specified according to + * "specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/{computeApiVersion}/virtualMachineScaleSet.json#/definitions/VirtualMachineScaleSetVMProfile". + * + * @param baseVirtualMachineProfile the baseVirtualMachineProfile value to set. + * @return the ComputeProfile object itself. + */ + public ComputeProfile withBaseVirtualMachineProfile(BaseVirtualMachineProfile baseVirtualMachineProfile) { + this.baseVirtualMachineProfile = baseVirtualMachineProfile; + return this; + } + + /** + * Get the computeApiVersion property: Specifies the Microsoft.Compute API version to use when creating underlying + * Virtual Machine scale sets and Virtual Machines. + * The default value will be the latest supported computeApiVersion by Compute Fleet. + * + * @return the computeApiVersion value. + */ + public String computeApiVersion() { + return this.computeApiVersion; + } + + /** + * Set the computeApiVersion property: Specifies the Microsoft.Compute API version to use when creating underlying + * Virtual Machine scale sets and Virtual Machines. + * The default value will be the latest supported computeApiVersion by Compute Fleet. + * + * @param computeApiVersion the computeApiVersion value to set. + * @return the ComputeProfile object itself. + */ + public ComputeProfile withComputeApiVersion(String computeApiVersion) { + this.computeApiVersion = computeApiVersion; + return this; + } + + /** + * Get the platformFaultDomainCount property: Specifies the number of fault domains to use when creating the + * underlying VMSS. + * A fault domain is a logical group of hardware within an Azure datacenter. + * VMs in the same fault domain share a common power source and network switch. + * If not specified, defaults to 1, which represents "Max Spreading" (using as many fault domains as possible). + * This property cannot be updated. + * + * @return the platformFaultDomainCount value. + */ + public Integer platformFaultDomainCount() { + return this.platformFaultDomainCount; + } + + /** + * Set the platformFaultDomainCount property: Specifies the number of fault domains to use when creating the + * underlying VMSS. + * A fault domain is a logical group of hardware within an Azure datacenter. + * VMs in the same fault domain share a common power source and network switch. + * If not specified, defaults to 1, which represents "Max Spreading" (using as many fault domains as possible). + * This property cannot be updated. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set. + * @return the ComputeProfile object itself. + */ + public ComputeProfile withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + this.platformFaultDomainCount = platformFaultDomainCount; + return this; + } + + /** + * Get the additionalVirtualMachineCapabilities property: Specifies VMSS and VM API entity models support two + * additional capabilities as of today: ultraSSDEnabled and hibernationEnabled. + * ultraSSDEnabled: Enables UltraSSD_LRS storage account type on the VMSS VMs. + * hibernationEnabled: Enables the hibernation capability on the VMSS VMs. + * Default value is null if not specified. This property cannot be updated once set. + * + * @return the additionalVirtualMachineCapabilities value. + */ + public AdditionalCapabilities additionalVirtualMachineCapabilities() { + return this.additionalVirtualMachineCapabilities; + } + + /** + * Set the additionalVirtualMachineCapabilities property: Specifies VMSS and VM API entity models support two + * additional capabilities as of today: ultraSSDEnabled and hibernationEnabled. + * ultraSSDEnabled: Enables UltraSSD_LRS storage account type on the VMSS VMs. + * hibernationEnabled: Enables the hibernation capability on the VMSS VMs. + * Default value is null if not specified. This property cannot be updated once set. + * + * @param additionalVirtualMachineCapabilities the additionalVirtualMachineCapabilities value to set. + * @return the ComputeProfile object itself. + */ + public ComputeProfile + withAdditionalVirtualMachineCapabilities(AdditionalCapabilities additionalVirtualMachineCapabilities) { + this.additionalVirtualMachineCapabilities = additionalVirtualMachineCapabilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baseVirtualMachineProfile() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property baseVirtualMachineProfile in model ComputeProfile")); + } else { + baseVirtualMachineProfile().validate(); + } + if (additionalVirtualMachineCapabilities() != null) { + additionalVirtualMachineCapabilities().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ComputeProfile.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("baseVirtualMachineProfile", this.baseVirtualMachineProfile); + jsonWriter.writeStringField("computeApiVersion", this.computeApiVersion); + jsonWriter.writeNumberField("platformFaultDomainCount", this.platformFaultDomainCount); + jsonWriter.writeJsonField("additionalVirtualMachineCapabilities", this.additionalVirtualMachineCapabilities); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComputeProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComputeProfile 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 ComputeProfile. + */ + public static ComputeProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComputeProfile deserializedComputeProfile = new ComputeProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseVirtualMachineProfile".equals(fieldName)) { + deserializedComputeProfile.baseVirtualMachineProfile = BaseVirtualMachineProfile.fromJson(reader); + } else if ("computeApiVersion".equals(fieldName)) { + deserializedComputeProfile.computeApiVersion = reader.getString(); + } else if ("platformFaultDomainCount".equals(fieldName)) { + deserializedComputeProfile.platformFaultDomainCount = reader.getNullable(JsonReader::getInt); + } else if ("additionalVirtualMachineCapabilities".equals(fieldName)) { + deserializedComputeProfile.additionalVirtualMachineCapabilities + = AdditionalCapabilities.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedComputeProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CpuManufacturer.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CpuManufacturer.java new file mode 100644 index 0000000000000..294ac8ec2423a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/CpuManufacturer.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Cpu Manufacturers supported by Azure VMs. + */ +public final class CpuManufacturer extends ExpandableStringEnum { + /** + * Static value Intel for CpuManufacturer. + */ + public static final CpuManufacturer INTEL = fromString("Intel"); + + /** + * Static value AMD for CpuManufacturer. + */ + public static final CpuManufacturer AMD = fromString("AMD"); + + /** + * Static value Microsoft for CpuManufacturer. + */ + public static final CpuManufacturer MICROSOFT = fromString("Microsoft"); + + /** + * Static value Ampere for CpuManufacturer. + */ + public static final CpuManufacturer AMPERE = fromString("Ampere"); + + /** + * Creates a new instance of CpuManufacturer value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CpuManufacturer() { + } + + /** + * Creates or finds a CpuManufacturer from its string representation. + * + * @param name a name to look for. + * @return the corresponding CpuManufacturer. + */ + public static CpuManufacturer fromString(String name) { + return fromString(name, CpuManufacturer.class); + } + + /** + * Gets known CpuManufacturer values. + * + * @return known CpuManufacturer values. + */ + public static Collection values() { + return values(CpuManufacturer.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DeleteOptions.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DeleteOptions.java new file mode 100644 index 0000000000000..623a7fcc0eb54 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DeleteOptions.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specify what happens to the network interface when the VM is deleted. + */ +public final class DeleteOptions extends ExpandableStringEnum { + /** + * Static value Delete for DeleteOptions. + */ + public static final DeleteOptions DELETE = fromString("Delete"); + + /** + * Static value Detach for DeleteOptions. + */ + public static final DeleteOptions DETACH = fromString("Detach"); + + /** + * Creates a new instance of DeleteOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeleteOptions() { + } + + /** + * Creates or finds a DeleteOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeleteOptions. + */ + public static DeleteOptions fromString(String name) { + return fromString(name, DeleteOptions.class); + } + + /** + * Gets known DeleteOptions values. + * + * @return known DeleteOptions values. + */ + public static Collection values() { + return values(DeleteOptions.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiagnosticsProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiagnosticsProfile.java new file mode 100644 index 0000000000000..eaadfd7d56a03 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiagnosticsProfile.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the boot diagnostic settings state. Minimum api-version: 2015-06-15. + */ +@Fluent +public final class DiagnosticsProfile implements JsonSerializable { + /* + * Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. **NOTE**: If storageUri is being + * specified then ensure that the storage account is in the same region and + * subscription as the VM. You can easily view the output of your console log. + * Azure also enables you to see a screenshot of the VM from the hypervisor. + */ + private BootDiagnostics bootDiagnostics; + + /** + * Creates an instance of DiagnosticsProfile class. + */ + public DiagnosticsProfile() { + } + + /** + * Get the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. **NOTE**: If storageUri is being + * specified then ensure that the storage account is in the same region and + * subscription as the VM. You can easily view the output of your console log. + * Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @return the bootDiagnostics value. + */ + public BootDiagnostics bootDiagnostics() { + return this.bootDiagnostics; + } + + /** + * Set the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output + * and Screenshot to diagnose VM status. **NOTE**: If storageUri is being + * specified then ensure that the storage account is in the same region and + * subscription as the VM. You can easily view the output of your console log. + * Azure also enables you to see a screenshot of the VM from the hypervisor. + * + * @param bootDiagnostics the bootDiagnostics value to set. + * @return the DiagnosticsProfile object itself. + */ + public DiagnosticsProfile withBootDiagnostics(BootDiagnostics bootDiagnostics) { + this.bootDiagnostics = bootDiagnostics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (bootDiagnostics() != null) { + bootDiagnostics().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("bootDiagnostics", this.bootDiagnostics); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiagnosticsProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiagnosticsProfile 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 DiagnosticsProfile. + */ + public static DiagnosticsProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiagnosticsProfile deserializedDiagnosticsProfile = new DiagnosticsProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("bootDiagnostics".equals(fieldName)) { + deserializedDiagnosticsProfile.bootDiagnostics = BootDiagnostics.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiagnosticsProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskOptions.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskOptions.java new file mode 100644 index 0000000000000..9b875a09d850d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskOptions.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the ephemeral disk option for operating system disk. + */ +public final class DiffDiskOptions extends ExpandableStringEnum { + /** + * Static value Local for DiffDiskOptions. + */ + public static final DiffDiskOptions LOCAL = fromString("Local"); + + /** + * Creates a new instance of DiffDiskOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiffDiskOptions() { + } + + /** + * Creates or finds a DiffDiskOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffDiskOptions. + */ + public static DiffDiskOptions fromString(String name) { + return fromString(name, DiffDiskOptions.class); + } + + /** + * Gets known DiffDiskOptions values. + * + * @return known DiffDiskOptions values. + */ + public static Collection values() { + return values(DiffDiskOptions.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskPlacement.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskPlacement.java new file mode 100644 index 0000000000000..72c069f23d4c1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskPlacement.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the ephemeral disk placement for operating system disk. This property + * can be used by user in the request to choose the location i.e, cache disk or + * resource disk space for Ephemeral OS disk provisioning. For more information on + * Ephemeral OS disk size requirements, please refer Ephemeral OS disk size + * requirements for Windows VM at + * https://learn.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements + * and Linux VM at + * https://learn.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements + * Minimum api-version for NvmeDisk: 2024-03-01. + */ +public final class DiffDiskPlacement extends ExpandableStringEnum { + /** + * Static value CacheDisk for DiffDiskPlacement. + */ + public static final DiffDiskPlacement CACHE_DISK = fromString("CacheDisk"); + + /** + * Static value ResourceDisk for DiffDiskPlacement. + */ + public static final DiffDiskPlacement RESOURCE_DISK = fromString("ResourceDisk"); + + /** + * Static value NvmeDisk for DiffDiskPlacement. + */ + public static final DiffDiskPlacement NVME_DISK = fromString("NvmeDisk"); + + /** + * Creates a new instance of DiffDiskPlacement value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiffDiskPlacement() { + } + + /** + * Creates or finds a DiffDiskPlacement from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffDiskPlacement. + */ + public static DiffDiskPlacement fromString(String name) { + return fromString(name, DiffDiskPlacement.class); + } + + /** + * Gets known DiffDiskPlacement values. + * + * @return known DiffDiskPlacement values. + */ + public static Collection values() { + return values(DiffDiskPlacement.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskSettings.java new file mode 100644 index 0000000000000..d9c1b08457072 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiffDiskSettings.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the parameters of ephemeral disk settings that can be specified for + * operating system disk. **Note:** The ephemeral disk settings can only be + * specified for managed disk. + */ +@Fluent +public final class DiffDiskSettings implements JsonSerializable { + /* + * Specifies the ephemeral disk settings for operating system disk. + */ + private DiffDiskOptions option; + + /* + * Specifies the ephemeral disk placement for operating system disk. Possible + * values are: **CacheDisk,** **ResourceDisk.** The defaulting behavior is: + * **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** + * is used. Refer to the VM size documentation for Windows VM at + * https://learn.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + * https://learn.microsoft.com/azure/virtual-machines/linux/sizes to check which VM + * sizes exposes a cache disk. + */ + private DiffDiskPlacement placement; + + /** + * Creates an instance of DiffDiskSettings class. + */ + public DiffDiskSettings() { + } + + /** + * Get the option property: Specifies the ephemeral disk settings for operating system disk. + * + * @return the option value. + */ + public DiffDiskOptions option() { + return this.option; + } + + /** + * Set the option property: Specifies the ephemeral disk settings for operating system disk. + * + * @param option the option value to set. + * @return the DiffDiskSettings object itself. + */ + public DiffDiskSettings withOption(DiffDiskOptions option) { + this.option = option; + return this; + } + + /** + * Get the placement property: Specifies the ephemeral disk placement for operating system disk. Possible + * values are: **CacheDisk,** **ResourceDisk.** The defaulting behavior is: + * **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** + * is used. Refer to the VM size documentation for Windows VM at + * https://learn.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + * https://learn.microsoft.com/azure/virtual-machines/linux/sizes to check which VM + * sizes exposes a cache disk. + * + * @return the placement value. + */ + public DiffDiskPlacement placement() { + return this.placement; + } + + /** + * Set the placement property: Specifies the ephemeral disk placement for operating system disk. Possible + * values are: **CacheDisk,** **ResourceDisk.** The defaulting behavior is: + * **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** + * is used. Refer to the VM size documentation for Windows VM at + * https://learn.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + * https://learn.microsoft.com/azure/virtual-machines/linux/sizes to check which VM + * sizes exposes a cache disk. + * + * @param placement the placement value to set. + * @return the DiffDiskSettings object itself. + */ + public DiffDiskSettings withPlacement(DiffDiskPlacement placement) { + this.placement = placement; + 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("option", this.option == null ? null : this.option.toString()); + jsonWriter.writeStringField("placement", this.placement == null ? null : this.placement.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiffDiskSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiffDiskSettings 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 DiffDiskSettings. + */ + public static DiffDiskSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiffDiskSettings deserializedDiffDiskSettings = new DiffDiskSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("option".equals(fieldName)) { + deserializedDiffDiskSettings.option = DiffDiskOptions.fromString(reader.getString()); + } else if ("placement".equals(fieldName)) { + deserializedDiffDiskSettings.placement = DiffDiskPlacement.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiffDiskSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskControllerTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskControllerTypes.java new file mode 100644 index 0000000000000..f50994716173d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskControllerTypes.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the disk controller type configured for the VM and + * VirtualMachineScaleSet. This property is only supported for virtual machines + * whose operating system disk and VM sku supports Generation 2 + * (https://learn.microsoft.com/en-us/azure/virtual-machines/generation-2), please + * check the HyperVGenerations capability returned as part of VM sku capabilities + * in the response of Microsoft.Compute SKUs api for the region contains V2 + * (https://learn.microsoft.com/rest/api/compute/resourceskus/list). For more + * information about Disk Controller Types supported please refer to + * https://aka.ms/azure-diskcontrollertypes. + */ +public final class DiskControllerTypes extends ExpandableStringEnum { + /** + * Static value SCSI for DiskControllerTypes. + */ + public static final DiskControllerTypes SCSI = fromString("SCSI"); + + /** + * Static value NVMe for DiskControllerTypes. + */ + public static final DiskControllerTypes NVME = fromString("NVMe"); + + /** + * Creates a new instance of DiskControllerTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiskControllerTypes() { + } + + /** + * Creates or finds a DiskControllerTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskControllerTypes. + */ + public static DiskControllerTypes fromString(String name) { + return fromString(name, DiskControllerTypes.class); + } + + /** + * Gets known DiskControllerTypes values. + * + * @return known DiskControllerTypes values. + */ + public static Collection values() { + return values(DiskControllerTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskCreateOptionTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskCreateOptionTypes.java new file mode 100644 index 0000000000000..5928ed0a6d302 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskCreateOptionTypes.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies how the virtual machine should be created. + */ +public final class DiskCreateOptionTypes extends ExpandableStringEnum { + /** + * Static value FromImage for DiskCreateOptionTypes. + */ + public static final DiskCreateOptionTypes FROM_IMAGE = fromString("FromImage"); + + /** + * Static value Empty for DiskCreateOptionTypes. + */ + public static final DiskCreateOptionTypes EMPTY = fromString("Empty"); + + /** + * Static value Attach for DiskCreateOptionTypes. + */ + public static final DiskCreateOptionTypes ATTACH = fromString("Attach"); + + /** + * Static value Copy for DiskCreateOptionTypes. + */ + public static final DiskCreateOptionTypes COPY = fromString("Copy"); + + /** + * Static value Restore for DiskCreateOptionTypes. + */ + public static final DiskCreateOptionTypes RESTORE = fromString("Restore"); + + /** + * Creates a new instance of DiskCreateOptionTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiskCreateOptionTypes() { + } + + /** + * Creates or finds a DiskCreateOptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskCreateOptionTypes. + */ + public static DiskCreateOptionTypes fromString(String name) { + return fromString(name, DiskCreateOptionTypes.class); + } + + /** + * Gets known DiskCreateOptionTypes values. + * + * @return known DiskCreateOptionTypes values. + */ + public static Collection values() { + return values(DiskCreateOptionTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskDeleteOptionTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskDeleteOptionTypes.java new file mode 100644 index 0000000000000..0c3b141c95389 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskDeleteOptionTypes.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the behavior of the managed disk when the VM gets deleted, for + * example whether the managed disk is deleted or detached. Supported values are: + * **Delete.** If this value is used, the managed disk is deleted when VM gets + * deleted. **Detach.** If this value is used, the managed disk is retained after + * VM gets deleted. Minimum api-version: 2021-03-01. + */ +public final class DiskDeleteOptionTypes extends ExpandableStringEnum { + /** + * Static value Delete for DiskDeleteOptionTypes. + */ + public static final DiskDeleteOptionTypes DELETE = fromString("Delete"); + + /** + * Static value Detach for DiskDeleteOptionTypes. + */ + public static final DiskDeleteOptionTypes DETACH = fromString("Detach"); + + /** + * Creates a new instance of DiskDeleteOptionTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiskDeleteOptionTypes() { + } + + /** + * Creates or finds a DiskDeleteOptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskDeleteOptionTypes. + */ + public static DiskDeleteOptionTypes fromString(String name) { + return fromString(name, DiskDeleteOptionTypes.class); + } + + /** + * Gets known DiskDeleteOptionTypes values. + * + * @return known DiskDeleteOptionTypes values. + */ + public static Collection values() { + return values(DiskDeleteOptionTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskEncryptionSetParameters.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskEncryptionSetParameters.java new file mode 100644 index 0000000000000..b4335cce16156 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DiskEncryptionSetParameters.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the parameter of customer managed disk encryption set resource id + * that can be specified for disk. **Note:** The disk encryption set resource id + * can only be specified for managed disk. Please refer + * https://aka.ms/mdssewithcmkoverview for more details. + */ +@Fluent +public final class DiskEncryptionSetParameters implements JsonSerializable { + /* + * Resource Id + */ + private String id; + + /** + * Creates an instance of DiskEncryptionSetParameters class. + */ + public DiskEncryptionSetParameters() { + } + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the DiskEncryptionSetParameters object itself. + */ + public DiskEncryptionSetParameters withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskEncryptionSetParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskEncryptionSetParameters 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 DiskEncryptionSetParameters. + */ + public static DiskEncryptionSetParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskEncryptionSetParameters deserializedDiskEncryptionSetParameters = new DiskEncryptionSetParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiskEncryptionSetParameters.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskEncryptionSetParameters; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DomainNameLabelScopeTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DomainNameLabelScopeTypes.java new file mode 100644 index 0000000000000..1c009e5d8b92e --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/DomainNameLabelScopeTypes.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Domain name label scope.The concatenation of the hashed domain name label + * that generated according to the policy from domain name label scope and vm + * index will be the domain name labels of the PublicIPAddress resources that will + * be created. + */ +public final class DomainNameLabelScopeTypes extends ExpandableStringEnum { + /** + * Static value TenantReuse for DomainNameLabelScopeTypes. + */ + public static final DomainNameLabelScopeTypes TENANT_REUSE = fromString("TenantReuse"); + + /** + * Static value SubscriptionReuse for DomainNameLabelScopeTypes. + */ + public static final DomainNameLabelScopeTypes SUBSCRIPTION_REUSE = fromString("SubscriptionReuse"); + + /** + * Static value ResourceGroupReuse for DomainNameLabelScopeTypes. + */ + public static final DomainNameLabelScopeTypes RESOURCE_GROUP_REUSE = fromString("ResourceGroupReuse"); + + /** + * Static value NoReuse for DomainNameLabelScopeTypes. + */ + public static final DomainNameLabelScopeTypes NO_REUSE = fromString("NoReuse"); + + /** + * Creates a new instance of DomainNameLabelScopeTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DomainNameLabelScopeTypes() { + } + + /** + * Creates or finds a DomainNameLabelScopeTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding DomainNameLabelScopeTypes. + */ + public static DomainNameLabelScopeTypes fromString(String name) { + return fromString(name, DomainNameLabelScopeTypes.class); + } + + /** + * Gets known DomainNameLabelScopeTypes values. + * + * @return known DomainNameLabelScopeTypes values. + */ + public static Collection values() { + return values(DomainNameLabelScopeTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EncryptionIdentity.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EncryptionIdentity.java new file mode 100644 index 0000000000000..6933cdd088970 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EncryptionIdentity.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the Managed Identity used by ADE to get access token for keyvault + * operations. + */ +@Fluent +public final class EncryptionIdentity implements JsonSerializable { + /* + * Specifies ARM Resource ID of one of the user identities associated with the VM. + */ + private String userAssignedIdentityResourceId; + + /** + * Creates an instance of EncryptionIdentity class. + */ + public EncryptionIdentity() { + } + + /** + * Get the userAssignedIdentityResourceId property: Specifies ARM Resource ID of one of the user identities + * associated with the VM. + * + * @return the userAssignedIdentityResourceId value. + */ + public String userAssignedIdentityResourceId() { + return this.userAssignedIdentityResourceId; + } + + /** + * Set the userAssignedIdentityResourceId property: Specifies ARM Resource ID of one of the user identities + * associated with the VM. + * + * @param userAssignedIdentityResourceId the userAssignedIdentityResourceId value to set. + * @return the EncryptionIdentity object itself. + */ + public EncryptionIdentity withUserAssignedIdentityResourceId(String userAssignedIdentityResourceId) { + this.userAssignedIdentityResourceId = userAssignedIdentityResourceId; + 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("userAssignedIdentityResourceId", this.userAssignedIdentityResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncryptionIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncryptionIdentity 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 EncryptionIdentity. + */ + public static EncryptionIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncryptionIdentity deserializedEncryptionIdentity = new EncryptionIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userAssignedIdentityResourceId".equals(fieldName)) { + deserializedEncryptionIdentity.userAssignedIdentityResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEncryptionIdentity; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EvictionPolicy.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EvictionPolicy.java new file mode 100644 index 0000000000000..f0c3daa31ac74 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/EvictionPolicy.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Different kind of eviction policies. + */ +public final class EvictionPolicy extends ExpandableStringEnum { + /** + * Static value Delete for EvictionPolicy. + */ + public static final EvictionPolicy DELETE = fromString("Delete"); + + /** + * Static value Deallocate for EvictionPolicy. + */ + public static final EvictionPolicy DEALLOCATE = fromString("Deallocate"); + + /** + * Creates a new instance of EvictionPolicy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EvictionPolicy() { + } + + /** + * Creates or finds a EvictionPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding EvictionPolicy. + */ + public static EvictionPolicy fromString(String name) { + return fromString(name, EvictionPolicy.class); + } + + /** + * Gets known EvictionPolicy values. + * + * @return known EvictionPolicy values. + */ + public static Collection values() { + return values(EvictionPolicy.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleet.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleet.java new file mode 100644 index 0000000000000..7a9549a963737 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleet.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetInner; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetProperties; +import java.time.OffsetDateTime; +import java.util.List; +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 zones property: Zones in which the Compute Fleet is available. + * + * @return the zones value. + */ + List zones(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the plan property: Details of the resource plan. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet. + * + * @return the spotPriorityProfile value. + */ + SpotPriorityProfile spotPriorityProfile(); + + /** + * Gets the regularPriorityProfile property: Configuration Options for Regular instances in Compute Fleet. + * + * @return the regularPriorityProfile value. + */ + RegularPriorityProfile regularPriorityProfile(); + + /** + * Gets the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @return the vmSizesProfile value. + */ + List vmSizesProfile(); + + /** + * Gets the vmAttributes property: Attribute based Fleet. + * + * @return the vmAttributes value. + */ + VMAttributes vmAttributes(); + + /** + * Gets the additionalLocationsProfile property: Represents the configuration for additional locations where Fleet + * resources may be deployed. + * + * @return the additionalLocationsProfile value. + */ + AdditionalLocationsProfile additionalLocationsProfile(); + + /** + * Gets the computeProfile property: Compute Profile to use for running user's workloads. + * + * @return the computeProfile value. + */ + ComputeProfile computeProfile(); + + /** + * Gets the timeCreated property: Specifies the time at which the Compute Fleet is created. + * + * @return the timeCreated value. + */ + OffsetDateTime timeCreated(); + + /** + * Gets the uniqueId property: Specifies the ID which uniquely identifies a Compute Fleet. + * + * @return the uniqueId value. + */ + String uniqueId(); + + /** + * 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.azurefleet.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.WithZones, + DefinitionStages.WithIdentity, DefinitionStages.WithPlan, DefinitionStages.WithSpotPriorityProfile, + DefinitionStages.WithRegularPriorityProfile, DefinitionStages.WithVmSizesProfile, + DefinitionStages.WithVmAttributes, DefinitionStages.WithAdditionalLocationsProfile, + DefinitionStages.WithComputeProfile { + /** + * 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 zones. + */ + interface WithZones { + /** + * Specifies the zones property: Zones in which the Compute Fleet is available. + * + * @param zones Zones in which the Compute Fleet is available. + * @return the next definition stage. + */ + WithCreate withZones(List zones); + } + + /** + * The stage of the Fleet definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the Fleet definition allowing to specify plan. + */ + interface WithPlan { + /** + * Specifies the plan property: Details of the resource plan.. + * + * @param plan Details of the resource plan. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + + /** + * The stage of the Fleet definition allowing to specify spotPriorityProfile. + */ + interface WithSpotPriorityProfile { + /** + * Specifies the spotPriorityProfile property: Configuration Options for Spot instances in Compute Fleet.. + * + * @param spotPriorityProfile Configuration Options for Spot instances in Compute Fleet. + * @return the next definition stage. + */ + WithCreate withSpotPriorityProfile(SpotPriorityProfile spotPriorityProfile); + } + + /** + * The stage of the Fleet definition allowing to specify regularPriorityProfile. + */ + interface WithRegularPriorityProfile { + /** + * Specifies the regularPriorityProfile property: Configuration Options for Regular instances in Compute + * Fleet.. + * + * @param regularPriorityProfile Configuration Options for Regular instances in Compute Fleet. + * @return the next definition stage. + */ + WithCreate withRegularPriorityProfile(RegularPriorityProfile regularPriorityProfile); + } + + /** + * The stage of the Fleet definition allowing to specify vmSizesProfile. + */ + interface WithVmSizesProfile { + /** + * Specifies the vmSizesProfile property: List of VM sizes supported for Compute Fleet. + * + * @param vmSizesProfile List of VM sizes supported for Compute Fleet. + * @return the next definition stage. + */ + WithCreate withVmSizesProfile(List vmSizesProfile); + } + + /** + * The stage of the Fleet definition allowing to specify vmAttributes. + */ + interface WithVmAttributes { + /** + * Specifies the vmAttributes property: Attribute based Fleet.. + * + * @param vmAttributes Attribute based Fleet. + * @return the next definition stage. + */ + WithCreate withVmAttributes(VMAttributes vmAttributes); + } + + /** + * The stage of the Fleet definition allowing to specify additionalLocationsProfile. + */ + interface WithAdditionalLocationsProfile { + /** + * Specifies the additionalLocationsProfile property: Represents the configuration for additional locations + * where Fleet resources may be deployed.. + * + * @param additionalLocationsProfile Represents the configuration for additional locations where Fleet + * resources may be deployed. + * @return the next definition stage. + */ + WithCreate withAdditionalLocationsProfile(AdditionalLocationsProfile additionalLocationsProfile); + } + + /** + * The stage of the Fleet definition allowing to specify computeProfile. + */ + interface WithComputeProfile { + /** + * Specifies the computeProfile property: Compute Profile to use for running user's workloads.. + * + * @param computeProfile Compute Profile to use for running user's workloads. + * @return the next definition stage. + */ + WithCreate withComputeProfile(ComputeProfile computeProfile); + } + } + + /** + * 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.WithIdentity, UpdateStages.WithPlan, 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 identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Updatable managed service identity. + * + * @param identity Updatable managed service identity. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentityUpdate identity); + } + + /** + * The stage of the Fleet update allowing to specify plan. + */ + interface WithPlan { + /** + * Specifies the plan property: Updatable resource plan. + * + * @param plan Updatable resource plan. + * @return the next definition stage. + */ + Update withPlan(ResourcePlanUpdate plan); + } + + /** + * The stage of the Fleet update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: RP-specific updatable properties. + * + * @param properties RP-specific updatable 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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetListResult.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetListResult.java new file mode 100644 index 0000000000000..4ec4225583ad1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Fleet list operation. + */ +@Fluent +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. + */ + public FleetListResult() { + } + + /** + * Get the value property: The Fleet items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Fleet items on this page. + * + * @param value the value value to set. + * @return the FleetListResult object itself. + */ + public FleetListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the FleetListResult object itself. + */ + public FleetListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model 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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetUpdate.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetUpdate.java new file mode 100644 index 0000000000000..d12e30691ffab --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/FleetUpdate.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Fleet Update Model. + */ +@Fluent +public final class FleetUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Updatable managed service identity + */ + private ManagedServiceIdentityUpdate identity; + + /* + * Updatable resource plan + */ + private ResourcePlanUpdate plan; + + /* + * RP-specific updatable 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 identity property: Updatable managed service identity. + * + * @return the identity value. + */ + public ManagedServiceIdentityUpdate identity() { + return this.identity; + } + + /** + * Set the identity property: Updatable managed service identity. + * + * @param identity the identity value to set. + * @return the FleetUpdate object itself. + */ + public FleetUpdate withIdentity(ManagedServiceIdentityUpdate identity) { + this.identity = identity; + return this; + } + + /** + * Get the plan property: Updatable resource plan. + * + * @return the plan value. + */ + public ResourcePlanUpdate plan() { + return this.plan; + } + + /** + * Set the plan property: Updatable resource plan. + * + * @param plan the plan value to set. + * @return the FleetUpdate object itself. + */ + public FleetUpdate withPlan(ResourcePlanUpdate plan) { + this.plan = plan; + return this; + } + + /** + * Get the properties property: RP-specific updatable properties. + * + * @return the properties value. + */ + public FleetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: RP-specific updatable 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 (identity() != null) { + identity().validate(); + } + if (plan() != null) { + plan().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("identity", this.identity); + jsonWriter.writeJsonField("plan", this.plan); + 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 ("identity".equals(fieldName)) { + deserializedFleetUpdate.identity = ManagedServiceIdentityUpdate.fromJson(reader); + } else if ("plan".equals(fieldName)) { + deserializedFleetUpdate.plan = ResourcePlanUpdate.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedFleetUpdate.properties = FleetProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFleetUpdate; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleets.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleets.java new file mode 100644 index 0000000000000..9175f20dd19e4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Fleets.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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 { + /** + * List Fleet resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Fleet resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Fleet resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Fleet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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 along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String fleetName, Context context); + + /** + * Get a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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. + */ + Fleet getByResourceGroup(String resourceGroupName, String fleetName); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * Delete a Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param fleetName The name of the Compute 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); + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name); + + /** + * List VirtualMachineScaleSet resources by Fleet. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the 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 response of a VirtualMachineScaleSet list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listVirtualMachineScaleSets(String resourceGroupName, String name, + Context context); + + /** + * Get 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. + * @return a Fleet along with {@link Response}. + */ + Fleet getById(String id); + + /** + * Get 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. + * @return a Fleet along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete 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); + + /** + * Delete 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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ImageReference.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ImageReference.java new file mode 100644 index 0000000000000..c27e2eeae149b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ImageReference.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is + * required when you want to use a platform image, marketplace image, or virtual + * machine image, but is not used in other creation operations. NOTE: Image + * reference publisher and offer can only be set when you create the scale set. + */ +@Fluent +public final class ImageReference implements JsonSerializable { + /* + * Resource Id + */ + private String id; + + /* + * The image publisher. + */ + private String publisher; + + /* + * Specifies the offer of the platform image or marketplace image used to create + * the virtual machine. + */ + private String offer; + + /* + * The image SKU. + */ + private String sku; + + /* + * Specifies the version of the platform image or marketplace image used to create + * the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. + * Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest + * version of an image available at deploy time. Even if you use 'latest', the VM + * image will not automatically update after deploy time even if a new version + * becomes available. Please do not use field 'version' for gallery image + * deployment, gallery image should always use 'id' field for deployment, to use 'latest' + * version of gallery image, just set + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{ + * galleryName}/images/{imageName}' + * in the 'id' field without version input. + */ + private String version; + + /* + * Specifies in decimal numbers, the version of platform image or marketplace + * image used to create the virtual machine. This readonly field differs from 'version', + * only if the value specified in 'version' field is 'latest'. + */ + private String exactVersion; + + /* + * Specified the shared gallery image unique id for vm deployment. This can be + * fetched from shared gallery image GET call. + */ + private String sharedGalleryImageId; + + /* + * Specified the community gallery image unique id for vm deployment. This can be + * fetched from community gallery image GET call. + */ + private String communityGalleryImageId; + + /** + * Creates an instance of ImageReference class. + */ + public ImageReference() { + } + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource Id. + * + * @param id the id value to set. + * @return the ImageReference object itself. + */ + public ImageReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the publisher property: The image publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The image publisher. + * + * @param publisher the publisher value to set. + * @return the ImageReference object itself. + */ + public ImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: Specifies the offer of the platform image or marketplace image used to create + * the virtual machine. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: Specifies the offer of the platform image or marketplace image used to create + * the virtual machine. + * + * @param offer the offer value to set. + * @return the ImageReference object itself. + */ + public ImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: The image SKU. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The image SKU. + * + * @param sku the sku value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the version property: Specifies the version of the platform image or marketplace image used to create + * the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. + * Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest + * version of an image available at deploy time. Even if you use 'latest', the VM + * image will not automatically update after deploy time even if a new version + * becomes available. Please do not use field 'version' for gallery image + * deployment, gallery image should always use 'id' field for deployment, to use 'latest' + * version of gallery image, just set + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + * in the 'id' field without version input. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Specifies the version of the platform image or marketplace image used to create + * the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. + * Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest + * version of an image available at deploy time. Even if you use 'latest', the VM + * image will not automatically update after deploy time even if a new version + * becomes available. Please do not use field 'version' for gallery image + * deployment, gallery image should always use 'id' field for deployment, to use 'latest' + * version of gallery image, just set + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + * in the 'id' field without version input. + * + * @param version the version value to set. + * @return the ImageReference object itself. + */ + public ImageReference withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the exactVersion property: Specifies in decimal numbers, the version of platform image or marketplace + * image used to create the virtual machine. This readonly field differs from 'version', + * only if the value specified in 'version' field is 'latest'. + * + * @return the exactVersion value. + */ + public String exactVersion() { + return this.exactVersion; + } + + /** + * Get the sharedGalleryImageId property: Specified the shared gallery image unique id for vm deployment. This can + * be + * fetched from shared gallery image GET call. + * + * @return the sharedGalleryImageId value. + */ + public String sharedGalleryImageId() { + return this.sharedGalleryImageId; + } + + /** + * Set the sharedGalleryImageId property: Specified the shared gallery image unique id for vm deployment. This can + * be + * fetched from shared gallery image GET call. + * + * @param sharedGalleryImageId the sharedGalleryImageId value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSharedGalleryImageId(String sharedGalleryImageId) { + this.sharedGalleryImageId = sharedGalleryImageId; + return this; + } + + /** + * Get the communityGalleryImageId property: Specified the community gallery image unique id for vm deployment. This + * can be + * fetched from community gallery image GET call. + * + * @return the communityGalleryImageId value. + */ + public String communityGalleryImageId() { + return this.communityGalleryImageId; + } + + /** + * Set the communityGalleryImageId property: Specified the community gallery image unique id for vm deployment. This + * can be + * fetched from community gallery image GET call. + * + * @param communityGalleryImageId the communityGalleryImageId value to set. + * @return the ImageReference object itself. + */ + public ImageReference withCommunityGalleryImageId(String communityGalleryImageId) { + this.communityGalleryImageId = communityGalleryImageId; + 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("id", this.id); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("offer", this.offer); + jsonWriter.writeStringField("sku", this.sku); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("sharedGalleryImageId", this.sharedGalleryImageId); + jsonWriter.writeStringField("communityGalleryImageId", this.communityGalleryImageId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageReference 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 ImageReference. + */ + public static ImageReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageReference deserializedImageReference = new ImageReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedImageReference.id = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedImageReference.publisher = reader.getString(); + } else if ("offer".equals(fieldName)) { + deserializedImageReference.offer = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedImageReference.sku = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedImageReference.version = reader.getString(); + } else if ("exactVersion".equals(fieldName)) { + deserializedImageReference.exactVersion = reader.getString(); + } else if ("sharedGalleryImageId".equals(fieldName)) { + deserializedImageReference.sharedGalleryImageId = reader.getString(); + } else if ("communityGalleryImageId".equals(fieldName)) { + deserializedImageReference.communityGalleryImageId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImageReference; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/InnerError.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/InnerError.java new file mode 100644 index 0000000000000..1234b5bf6699d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/InnerError.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Inner error details. + */ +@Fluent +public final class InnerError implements JsonSerializable { + /* + * The exception type. + */ + private String exceptionType; + + /* + * The internal error message or exception dump. + */ + private String errorDetail; + + /** + * Creates an instance of InnerError class. + */ + public InnerError() { + } + + /** + * Get the exceptionType property: The exception type. + * + * @return the exceptionType value. + */ + public String exceptionType() { + return this.exceptionType; + } + + /** + * Set the exceptionType property: The exception type. + * + * @param exceptionType the exceptionType value to set. + * @return the InnerError object itself. + */ + public InnerError withExceptionType(String exceptionType) { + this.exceptionType = exceptionType; + return this; + } + + /** + * Get the errorDetail property: The internal error message or exception dump. + * + * @return the errorDetail value. + */ + public String errorDetail() { + return this.errorDetail; + } + + /** + * Set the errorDetail property: The internal error message or exception dump. + * + * @param errorDetail the errorDetail value to set. + * @return the InnerError object itself. + */ + public InnerError withErrorDetail(String errorDetail) { + this.errorDetail = errorDetail; + 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("exceptionType", this.exceptionType); + jsonWriter.writeStringField("errorDetail", this.errorDetail); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerError 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 InnerError. + */ + public static InnerError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerError deserializedInnerError = new InnerError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("exceptionType".equals(fieldName)) { + deserializedInnerError.exceptionType = reader.getString(); + } else if ("errorDetail".equals(fieldName)) { + deserializedInnerError.errorDetail = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerError; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/IpVersion.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/IpVersion.java new file mode 100644 index 0000000000000..567a7be4f9cea --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/IpVersion.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Available from Api-Version 2017-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + */ +public final class IpVersion extends ExpandableStringEnum { + /** + * Static value IPv4 for IpVersion. + */ + public static final IpVersion IPV4 = fromString("IPv4"); + + /** + * Static value IPv6 for IpVersion. + */ + public static final IpVersion IPV6 = fromString("IPv6"); + + /** + * Creates a new instance of IpVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IpVersion() { + } + + /** + * Creates or finds a IpVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding IpVersion. + */ + public static IpVersion fromString(String name) { + return fromString(name, IpVersion.class); + } + + /** + * Gets known IpVersion values. + * + * @return known IpVersion values. + */ + public static Collection values() { + return values(IpVersion.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/KeyVaultSecretReference.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/KeyVaultSecretReference.java new file mode 100644 index 0000000000000..3e059bb59e36a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/KeyVaultSecretReference.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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; + +/** + * Describes a reference to Key Vault Secret. + */ +@Fluent +public final class KeyVaultSecretReference implements JsonSerializable { + /* + * The URL referencing a secret in a Key Vault. + */ + private String secretUrl; + + /* + * The relative URL of the Key Vault containing the secret. + */ + private SubResource sourceVault; + + /** + * Creates an instance of KeyVaultSecretReference class. + */ + public KeyVaultSecretReference() { + } + + /** + * Get the secretUrl property: The URL referencing a secret in a Key Vault. + * + * @return the secretUrl value. + */ + public String secretUrl() { + return this.secretUrl; + } + + /** + * Set the secretUrl property: The URL referencing a secret in a Key Vault. + * + * @param secretUrl the secretUrl value to set. + * @return the KeyVaultSecretReference object itself. + */ + public KeyVaultSecretReference withSecretUrl(String secretUrl) { + this.secretUrl = secretUrl; + return this; + } + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing the secret. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing the secret. + * + * @param sourceVault the sourceVault value to set. + * @return the KeyVaultSecretReference object itself. + */ + public KeyVaultSecretReference withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (secretUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property secretUrl in model KeyVaultSecretReference")); + } + if (sourceVault() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceVault in model KeyVaultSecretReference")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(KeyVaultSecretReference.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("secretUrl", this.secretUrl); + jsonWriter.writeJsonField("sourceVault", this.sourceVault); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyVaultSecretReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyVaultSecretReference 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 KeyVaultSecretReference. + */ + public static KeyVaultSecretReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyVaultSecretReference deserializedKeyVaultSecretReference = new KeyVaultSecretReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("secretUrl".equals(fieldName)) { + deserializedKeyVaultSecretReference.secretUrl = reader.getString(); + } else if ("sourceVault".equals(fieldName)) { + deserializedKeyVaultSecretReference.sourceVault = SubResource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyVaultSecretReference; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxConfiguration.java new file mode 100644 index 0000000000000..6da1f70db1b1e --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxConfiguration.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the Linux operating system settings on the virtual machine. For a + * list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + */ +@Fluent +public final class LinuxConfiguration implements JsonSerializable { + /* + * Specifies whether password authentication should be disabled. + */ + private Boolean disablePasswordAuthentication; + + /* + * Specifies the ssh key configuration for a Linux OS. + */ + private SshConfiguration ssh; + + /* + * Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, default + * behavior is to set it to true. This will ensure that VM Agent is installed on + * the VM so that extensions can be added to the VM later. + */ + private Boolean provisionVMAgent; + + /* + * [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + */ + private LinuxPatchSettings patchSettings; + + /* + * Indicates whether VMAgent Platform Updates is enabled for the Linux virtual + * machine. Default value is false. + */ + private Boolean enableVMAgentPlatformUpdates; + + /** + * Creates an instance of LinuxConfiguration class. + */ + public LinuxConfiguration() { + } + + /** + * Get the disablePasswordAuthentication property: Specifies whether password authentication should be disabled. + * + * @return the disablePasswordAuthentication value. + */ + public Boolean disablePasswordAuthentication() { + return this.disablePasswordAuthentication; + } + + /** + * Set the disablePasswordAuthentication property: Specifies whether password authentication should be disabled. + * + * @param disablePasswordAuthentication the disablePasswordAuthentication value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withDisablePasswordAuthentication(Boolean disablePasswordAuthentication) { + this.disablePasswordAuthentication = disablePasswordAuthentication; + return this; + } + + /** + * Get the ssh property: Specifies the ssh key configuration for a Linux OS. + * + * @return the ssh value. + */ + public SshConfiguration ssh() { + return this.ssh; + } + + /** + * Set the ssh property: Specifies the ssh key configuration for a Linux OS. + * + * @param ssh the ssh value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withSsh(SshConfiguration ssh) { + this.ssh = ssh; + return this; + } + + /** + * Get the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, default + * behavior is to set it to true. This will ensure that VM Agent is installed on + * the VM so that extensions can be added to the VM later. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, default + * behavior is to set it to true. This will ensure that VM Agent is installed on + * the VM so that extensions can be added to the VM later. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + * + * @return the patchSettings value. + */ + public LinuxPatchSettings patchSettings() { + return this.patchSettings; + } + + /** + * Set the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Linux. + * + * @param patchSettings the patchSettings value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withPatchSettings(LinuxPatchSettings patchSettings) { + this.patchSettings = patchSettings; + return this; + } + + /** + * Get the enableVMAgentPlatformUpdates property: Indicates whether VMAgent Platform Updates is enabled for the + * Linux virtual + * machine. Default value is false. + * + * @return the enableVMAgentPlatformUpdates value. + */ + public Boolean enableVMAgentPlatformUpdates() { + return this.enableVMAgentPlatformUpdates; + } + + /** + * Set the enableVMAgentPlatformUpdates property: Indicates whether VMAgent Platform Updates is enabled for the + * Linux virtual + * machine. Default value is false. + * + * @param enableVMAgentPlatformUpdates the enableVMAgentPlatformUpdates value to set. + * @return the LinuxConfiguration object itself. + */ + public LinuxConfiguration withEnableVMAgentPlatformUpdates(Boolean enableVMAgentPlatformUpdates) { + this.enableVMAgentPlatformUpdates = enableVMAgentPlatformUpdates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ssh() != null) { + ssh().validate(); + } + if (patchSettings() != null) { + patchSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("disablePasswordAuthentication", this.disablePasswordAuthentication); + jsonWriter.writeJsonField("ssh", this.ssh); + jsonWriter.writeBooleanField("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeJsonField("patchSettings", this.patchSettings); + jsonWriter.writeBooleanField("enableVMAgentPlatformUpdates", this.enableVMAgentPlatformUpdates); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinuxConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinuxConfiguration 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 LinuxConfiguration. + */ + public static LinuxConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinuxConfiguration deserializedLinuxConfiguration = new LinuxConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("disablePasswordAuthentication".equals(fieldName)) { + deserializedLinuxConfiguration.disablePasswordAuthentication + = reader.getNullable(JsonReader::getBoolean); + } else if ("ssh".equals(fieldName)) { + deserializedLinuxConfiguration.ssh = SshConfiguration.fromJson(reader); + } else if ("provisionVMAgent".equals(fieldName)) { + deserializedLinuxConfiguration.provisionVMAgent = reader.getNullable(JsonReader::getBoolean); + } else if ("patchSettings".equals(fieldName)) { + deserializedLinuxConfiguration.patchSettings = LinuxPatchSettings.fromJson(reader); + } else if ("enableVMAgentPlatformUpdates".equals(fieldName)) { + deserializedLinuxConfiguration.enableVMAgentPlatformUpdates + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedLinuxConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchAssessmentMode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchAssessmentMode.java new file mode 100644 index 0000000000000..50157effb32fc --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchAssessmentMode.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You + * control the timing of patch assessments on a virtual machine. <br /><br /> + * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + */ +public final class LinuxPatchAssessmentMode extends ExpandableStringEnum { + /** + * Static value ImageDefault for LinuxPatchAssessmentMode. + */ + public static final LinuxPatchAssessmentMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** + * Static value AutomaticByPlatform for LinuxPatchAssessmentMode. + */ + public static final LinuxPatchAssessmentMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates a new instance of LinuxPatchAssessmentMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinuxPatchAssessmentMode() { + } + + /** + * Creates or finds a LinuxPatchAssessmentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxPatchAssessmentMode. + */ + public static LinuxPatchAssessmentMode fromString(String name) { + return fromString(name, LinuxPatchAssessmentMode.class); + } + + /** + * Gets known LinuxPatchAssessmentMode values. + * + * @return known LinuxPatchAssessmentMode values. + */ + public static Collection values() { + return values(LinuxPatchAssessmentMode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchSettings.java new file mode 100644 index 0000000000000..f29ab75e25d10 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxPatchSettings.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies settings related to VM Guest Patching on Linux. + */ +@Fluent +public final class LinuxPatchSettings implements JsonSerializable { + /* + * Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.

Possible values are:

**ImageDefault** - The + * virtual machine's default patching configuration is used.

+ * **AutomaticByPlatform** - The virtual machine will be automatically updated by + * the platform. The property provisionVMAgent must be true + */ + private LinuxVMGuestPatchMode patchMode; + + /* + * Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.

Possible values are:

**ImageDefault** - You + * control the timing of patch assessments on a virtual machine.

+ * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + */ + private LinuxPatchAssessmentMode assessmentMode; + + /* + * Specifies additional settings for patch mode AutomaticByPlatform in VM Guest + * Patching on Linux. + */ + private LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings; + + /** + * Creates an instance of LinuxPatchSettings class. + */ + public LinuxPatchSettings() { + } + + /** + * Get the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - The + * virtual machine's default patching configuration is used. <br /><br /> + * **AutomaticByPlatform** - The virtual machine will be automatically updated by + * the platform. The property provisionVMAgent must be true. + * + * @return the patchMode value. + */ + public LinuxVMGuestPatchMode patchMode() { + return this.patchMode; + } + + /** + * Set the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - The + * virtual machine's default patching configuration is used. <br /><br /> + * **AutomaticByPlatform** - The virtual machine will be automatically updated by + * the platform. The property provisionVMAgent must be true. + * + * @param patchMode the patchMode value to set. + * @return the LinuxPatchSettings object itself. + */ + public LinuxPatchSettings withPatchMode(LinuxVMGuestPatchMode patchMode) { + this.patchMode = patchMode; + return this; + } + + /** + * Get the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You + * control the timing of patch assessments on a virtual machine. <br /><br /> + * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + * + * @return the assessmentMode value. + */ + public LinuxPatchAssessmentMode assessmentMode() { + return this.assessmentMode; + } + + /** + * Set the assessmentMode property: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You + * control the timing of patch assessments on a virtual machine. <br /><br /> + * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + * + * @param assessmentMode the assessmentMode value to set. + * @return the LinuxPatchSettings object itself. + */ + public LinuxPatchSettings withAssessmentMode(LinuxPatchAssessmentMode assessmentMode) { + this.assessmentMode = assessmentMode; + return this; + } + + /** + * Get the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in + * VM Guest + * Patching on Linux. + * + * @return the automaticByPlatformSettings value. + */ + public LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings() { + return this.automaticByPlatformSettings; + } + + /** + * Set the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in + * VM Guest + * Patching on Linux. + * + * @param automaticByPlatformSettings the automaticByPlatformSettings value to set. + * @return the LinuxPatchSettings object itself. + */ + public LinuxPatchSettings + withAutomaticByPlatformSettings(LinuxVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings) { + this.automaticByPlatformSettings = automaticByPlatformSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (automaticByPlatformSettings() != null) { + automaticByPlatformSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("patchMode", this.patchMode == null ? null : this.patchMode.toString()); + jsonWriter.writeStringField("assessmentMode", + this.assessmentMode == null ? null : this.assessmentMode.toString()); + jsonWriter.writeJsonField("automaticByPlatformSettings", this.automaticByPlatformSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinuxPatchSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinuxPatchSettings 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 LinuxPatchSettings. + */ + public static LinuxPatchSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinuxPatchSettings deserializedLinuxPatchSettings = new LinuxPatchSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("patchMode".equals(fieldName)) { + deserializedLinuxPatchSettings.patchMode = LinuxVMGuestPatchMode.fromString(reader.getString()); + } else if ("assessmentMode".equals(fieldName)) { + deserializedLinuxPatchSettings.assessmentMode + = LinuxPatchAssessmentMode.fromString(reader.getString()); + } else if ("automaticByPlatformSettings".equals(fieldName)) { + deserializedLinuxPatchSettings.automaticByPlatformSettings + = LinuxVMGuestPatchAutomaticByPlatformSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLinuxPatchSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.java new file mode 100644 index 0000000000000..f5743d5159a38 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformRebootSetting.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + */ +public final class LinuxVMGuestPatchAutomaticByPlatformRebootSetting + extends ExpandableStringEnum { + /** + * Static value Unknown for LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final LinuxVMGuestPatchAutomaticByPlatformRebootSetting UNKNOWN = fromString("Unknown"); + + /** + * Static value IfRequired for LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final LinuxVMGuestPatchAutomaticByPlatformRebootSetting IF_REQUIRED = fromString("IfRequired"); + + /** + * Static value Never for LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final LinuxVMGuestPatchAutomaticByPlatformRebootSetting NEVER = fromString("Never"); + + /** + * Static value Always for LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final LinuxVMGuestPatchAutomaticByPlatformRebootSetting ALWAYS = fromString("Always"); + + /** + * Creates a new instance of LinuxVMGuestPatchAutomaticByPlatformRebootSetting value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinuxVMGuestPatchAutomaticByPlatformRebootSetting() { + } + + /** + * Creates or finds a LinuxVMGuestPatchAutomaticByPlatformRebootSetting from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static LinuxVMGuestPatchAutomaticByPlatformRebootSetting fromString(String name) { + return fromString(name, LinuxVMGuestPatchAutomaticByPlatformRebootSetting.class); + } + + /** + * Gets known LinuxVMGuestPatchAutomaticByPlatformRebootSetting values. + * + * @return known LinuxVMGuestPatchAutomaticByPlatformRebootSetting values. + */ + public static Collection values() { + return values(LinuxVMGuestPatchAutomaticByPlatformRebootSetting.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformSettings.java new file mode 100644 index 0000000000000..8d8bf4af226b0 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchAutomaticByPlatformSettings.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies additional settings to be applied when patch mode AutomaticByPlatform + * is selected in Linux patch settings. + */ +@Fluent +public final class LinuxVMGuestPatchAutomaticByPlatformSettings + implements JsonSerializable { + /* + * Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + */ + private LinuxVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting; + + /* + * Enables customer to schedule patching without accidental upgrades + */ + private Boolean bypassPlatformSafetyChecksOnUserSchedule; + + /** + * Creates an instance of LinuxVMGuestPatchAutomaticByPlatformSettings class. + */ + public LinuxVMGuestPatchAutomaticByPlatformSettings() { + } + + /** + * Get the rebootSetting property: Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + * + * @return the rebootSetting value. + */ + public LinuxVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting() { + return this.rebootSetting; + } + + /** + * Set the rebootSetting property: Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + * + * @param rebootSetting the rebootSetting value to set. + * @return the LinuxVMGuestPatchAutomaticByPlatformSettings object itself. + */ + public LinuxVMGuestPatchAutomaticByPlatformSettings + withRebootSetting(LinuxVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting) { + this.rebootSetting = rebootSetting; + return this; + } + + /** + * Get the bypassPlatformSafetyChecksOnUserSchedule property: Enables customer to schedule patching without + * accidental upgrades. + * + * @return the bypassPlatformSafetyChecksOnUserSchedule value. + */ + public Boolean bypassPlatformSafetyChecksOnUserSchedule() { + return this.bypassPlatformSafetyChecksOnUserSchedule; + } + + /** + * Set the bypassPlatformSafetyChecksOnUserSchedule property: Enables customer to schedule patching without + * accidental upgrades. + * + * @param bypassPlatformSafetyChecksOnUserSchedule the bypassPlatformSafetyChecksOnUserSchedule value to set. + * @return the LinuxVMGuestPatchAutomaticByPlatformSettings object itself. + */ + public LinuxVMGuestPatchAutomaticByPlatformSettings + withBypassPlatformSafetyChecksOnUserSchedule(Boolean bypassPlatformSafetyChecksOnUserSchedule) { + this.bypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + 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("rebootSetting", this.rebootSetting == null ? null : this.rebootSetting.toString()); + jsonWriter.writeBooleanField("bypassPlatformSafetyChecksOnUserSchedule", + this.bypassPlatformSafetyChecksOnUserSchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinuxVMGuestPatchAutomaticByPlatformSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinuxVMGuestPatchAutomaticByPlatformSettings 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 LinuxVMGuestPatchAutomaticByPlatformSettings. + */ + public static LinuxVMGuestPatchAutomaticByPlatformSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinuxVMGuestPatchAutomaticByPlatformSettings deserializedLinuxVMGuestPatchAutomaticByPlatformSettings + = new LinuxVMGuestPatchAutomaticByPlatformSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rebootSetting".equals(fieldName)) { + deserializedLinuxVMGuestPatchAutomaticByPlatformSettings.rebootSetting + = LinuxVMGuestPatchAutomaticByPlatformRebootSetting.fromString(reader.getString()); + } else if ("bypassPlatformSafetyChecksOnUserSchedule".equals(fieldName)) { + deserializedLinuxVMGuestPatchAutomaticByPlatformSettings.bypassPlatformSafetyChecksOnUserSchedule + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedLinuxVMGuestPatchAutomaticByPlatformSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchMode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchMode.java new file mode 100644 index 0000000000000..bf29b33fbf13f --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LinuxVMGuestPatchMode.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible. + */ +public final class LinuxVMGuestPatchMode extends ExpandableStringEnum { + /** + * Static value ImageDefault for LinuxVMGuestPatchMode. + */ + public static final LinuxVMGuestPatchMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** + * Static value AutomaticByPlatform for LinuxVMGuestPatchMode. + */ + public static final LinuxVMGuestPatchMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates a new instance of LinuxVMGuestPatchMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinuxVMGuestPatchMode() { + } + + /** + * Creates or finds a LinuxVMGuestPatchMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxVMGuestPatchMode. + */ + public static LinuxVMGuestPatchMode fromString(String name) { + return fromString(name, LinuxVMGuestPatchMode.class); + } + + /** + * Gets known LinuxVMGuestPatchMode values. + * + * @return known LinuxVMGuestPatchMode values. + */ + public static Collection values() { + return values(LinuxVMGuestPatchMode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocalStorageDiskType.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocalStorageDiskType.java new file mode 100644 index 0000000000000..b28d1c50f99dd --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocalStorageDiskType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Different kind of Local storage disk types supported by Azure VMs. + */ +public final class LocalStorageDiskType extends ExpandableStringEnum { + /** + * Static value HDD for LocalStorageDiskType. + */ + public static final LocalStorageDiskType HDD = fromString("HDD"); + + /** + * Static value SSD for LocalStorageDiskType. + */ + public static final LocalStorageDiskType SSD = fromString("SSD"); + + /** + * Creates a new instance of LocalStorageDiskType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LocalStorageDiskType() { + } + + /** + * Creates or finds a LocalStorageDiskType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LocalStorageDiskType. + */ + public static LocalStorageDiskType fromString(String name) { + return fromString(name, LocalStorageDiskType.class); + } + + /** + * Gets known LocalStorageDiskType values. + * + * @return known LocalStorageDiskType values. + */ + public static Collection values() { + return values(LocalStorageDiskType.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocationProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocationProfile.java new file mode 100644 index 0000000000000..510166d9a9bc5 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/LocationProfile.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Represents the profile for a single additional location in the Fleet. The location and the + * virtualMachineProfileOverride (optional). + */ +@Fluent +public final class LocationProfile implements JsonSerializable { + /* + * The ARM location name of the additional region. If LocationProfile is specified, then location is required. + */ + private String location; + + /* + * An override for computeProfile.baseVirtualMachineProfile specific to this region. + * This override is merged with the base virtual machine profile to define the final virtual machine profile for the + * resources deployed in this location. + */ + private BaseVirtualMachineProfile virtualMachineProfileOverride; + + /** + * Creates an instance of LocationProfile class. + */ + public LocationProfile() { + } + + /** + * Get the location property: The ARM location name of the additional region. If LocationProfile is specified, then + * location is required. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The ARM location name of the additional region. If LocationProfile is specified, then + * location is required. + * + * @param location the location value to set. + * @return the LocationProfile object itself. + */ + public LocationProfile withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the virtualMachineProfileOverride property: An override for computeProfile.baseVirtualMachineProfile specific + * to this region. + * This override is merged with the base virtual machine profile to define the final virtual machine profile for the + * resources deployed in this location. + * + * @return the virtualMachineProfileOverride value. + */ + public BaseVirtualMachineProfile virtualMachineProfileOverride() { + return this.virtualMachineProfileOverride; + } + + /** + * Set the virtualMachineProfileOverride property: An override for computeProfile.baseVirtualMachineProfile specific + * to this region. + * This override is merged with the base virtual machine profile to define the final virtual machine profile for the + * resources deployed in this location. + * + * @param virtualMachineProfileOverride the virtualMachineProfileOverride value to set. + * @return the LocationProfile object itself. + */ + public LocationProfile withVirtualMachineProfileOverride(BaseVirtualMachineProfile virtualMachineProfileOverride) { + this.virtualMachineProfileOverride = virtualMachineProfileOverride; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model LocationProfile")); + } + if (virtualMachineProfileOverride() != null) { + virtualMachineProfileOverride().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LocationProfile.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("virtualMachineProfileOverride", this.virtualMachineProfileOverride); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationProfile 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 LocationProfile. + */ + public static LocationProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationProfile deserializedLocationProfile = new LocationProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedLocationProfile.location = reader.getString(); + } else if ("virtualMachineProfileOverride".equals(fieldName)) { + deserializedLocationProfile.virtualMachineProfileOverride + = BaseVirtualMachineProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentity.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..4665e419508db --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentity.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityType.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..9258d5b821f9b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityUpdate.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityUpdate.java new file mode 100644 index 0000000000000..5c5576cea2a8d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ManagedServiceIdentityUpdate.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The template for adding optional properties. + */ +@Fluent +public final class ManagedServiceIdentityUpdate implements JsonSerializable { + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentityUpdate class. + */ + public ManagedServiceIdentityUpdate() { + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentityUpdate object itself. + */ + public ManagedServiceIdentityUpdate withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentityUpdate object itself. + */ + public ManagedServiceIdentityUpdate + withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentityUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentityUpdate 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 ManagedServiceIdentityUpdate. + */ + public static ManagedServiceIdentityUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentityUpdate deserializedManagedServiceIdentityUpdate = new ManagedServiceIdentityUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentityUpdate.type + = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentities.fromJson(reader1)); + deserializedManagedServiceIdentityUpdate.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentityUpdate; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Mode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Mode.java new file mode 100644 index 0000000000000..76ad511f883c1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Mode.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the mode that ProxyAgent will execute on if the feature is enabled. + * ProxyAgent will start to audit or monitor but not enforce access control over + * requests to host endpoints in Audit mode, while in Enforce mode it will enforce + * access control. The default value is Enforce mode. + */ +public final class Mode extends ExpandableStringEnum { + /** + * Static value Audit for Mode. + */ + public static final Mode AUDIT = fromString("Audit"); + + /** + * Static value Enforce for Mode. + */ + public static final Mode ENFORCE = fromString("Enforce"); + + /** + * Creates a new instance of Mode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Mode() { + } + + /** + * Creates or finds a Mode from its string representation. + * + * @param name a name to look for. + * @return the corresponding Mode. + */ + public static Mode fromString(String name) { + return fromString(name, Mode.class); + } + + /** + * Gets known Mode values. + * + * @return known Mode values. + */ + public static Collection values() { + return values(Mode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkApiVersion.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkApiVersion.java new file mode 100644 index 0000000000000..8d96d51e6bcd8 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkApiVersion.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set + * with orchestration mode 'Flexible'. + */ +public final class NetworkApiVersion extends ExpandableStringEnum { + /** + * Static value 2020-11-01 for NetworkApiVersion. + */ + public static final NetworkApiVersion TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE = fromString("2020-11-01"); + + /** + * Creates a new instance of NetworkApiVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkApiVersion() { + } + + /** + * Creates or finds a NetworkApiVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkApiVersion. + */ + public static NetworkApiVersion fromString(String name) { + return fromString(name, NetworkApiVersion.class); + } + + /** + * Gets known NetworkApiVersion values. + * + * @return known NetworkApiVersion values. + */ + public static Collection values() { + return values(NetworkApiVersion.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliaryMode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliaryMode.java new file mode 100644 index 0000000000000..1d948b5bee339 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliaryMode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies whether the Auxiliary mode is enabled for the Network Interface + * resource. + */ +public final class NetworkInterfaceAuxiliaryMode extends ExpandableStringEnum { + /** + * Static value None for NetworkInterfaceAuxiliaryMode. + */ + public static final NetworkInterfaceAuxiliaryMode NONE = fromString("None"); + + /** + * Static value AcceleratedConnections for NetworkInterfaceAuxiliaryMode. + */ + public static final NetworkInterfaceAuxiliaryMode ACCELERATED_CONNECTIONS = fromString("AcceleratedConnections"); + + /** + * Static value Floating for NetworkInterfaceAuxiliaryMode. + */ + public static final NetworkInterfaceAuxiliaryMode FLOATING = fromString("Floating"); + + /** + * Creates a new instance of NetworkInterfaceAuxiliaryMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkInterfaceAuxiliaryMode() { + } + + /** + * Creates or finds a NetworkInterfaceAuxiliaryMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkInterfaceAuxiliaryMode. + */ + public static NetworkInterfaceAuxiliaryMode fromString(String name) { + return fromString(name, NetworkInterfaceAuxiliaryMode.class); + } + + /** + * Gets known NetworkInterfaceAuxiliaryMode values. + * + * @return known NetworkInterfaceAuxiliaryMode values. + */ + public static Collection values() { + return values(NetworkInterfaceAuxiliaryMode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliarySku.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliarySku.java new file mode 100644 index 0000000000000..37d2d528fbcb3 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/NetworkInterfaceAuxiliarySku.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies whether the Auxiliary sku is enabled for the Network Interface + * resource. + */ +public final class NetworkInterfaceAuxiliarySku extends ExpandableStringEnum { + /** + * Static value None for NetworkInterfaceAuxiliarySku. + */ + public static final NetworkInterfaceAuxiliarySku NONE = fromString("None"); + + /** + * Static value A1 for NetworkInterfaceAuxiliarySku. + */ + public static final NetworkInterfaceAuxiliarySku A1 = fromString("A1"); + + /** + * Static value A2 for NetworkInterfaceAuxiliarySku. + */ + public static final NetworkInterfaceAuxiliarySku A2 = fromString("A2"); + + /** + * Static value A4 for NetworkInterfaceAuxiliarySku. + */ + public static final NetworkInterfaceAuxiliarySku A4 = fromString("A4"); + + /** + * Static value A8 for NetworkInterfaceAuxiliarySku. + */ + public static final NetworkInterfaceAuxiliarySku A8 = fromString("A8"); + + /** + * Creates a new instance of NetworkInterfaceAuxiliarySku value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkInterfaceAuxiliarySku() { + } + + /** + * Creates or finds a NetworkInterfaceAuxiliarySku from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkInterfaceAuxiliarySku. + */ + public static NetworkInterfaceAuxiliarySku fromString(String name) { + return fromString(name, NetworkInterfaceAuxiliarySku.class); + } + + /** + * Gets known NetworkInterfaceAuxiliarySku values. + * + * @return known NetworkInterfaceAuxiliarySku values. + */ + public static Collection values() { + return values(NetworkInterfaceAuxiliarySku.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OSImageNotificationProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OSImageNotificationProfile.java new file mode 100644 index 0000000000000..068289823cc00 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OSImageNotificationProfile.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies OS Image Scheduled Event related configurations. + */ +@Fluent +public final class OSImageNotificationProfile implements JsonSerializable { + /* + * Length of time a Virtual Machine being reimaged or having its OS upgraded will + * have to potentially approve the OS Image Scheduled Event before the event is + * auto approved (timed out). The configuration is specified in ISO 8601 format, + * and the value must not exceed 15 minutes (PT15M) + */ + private String notBeforeTimeout; + + /* + * Specifies whether the OS Image Scheduled event is enabled or disabled. + */ + private Boolean enable; + + /** + * Creates an instance of OSImageNotificationProfile class. + */ + public OSImageNotificationProfile() { + } + + /** + * Get the notBeforeTimeout property: Length of time a Virtual Machine being reimaged or having its OS upgraded will + * have to potentially approve the OS Image Scheduled Event before the event is + * auto approved (timed out). The configuration is specified in ISO 8601 format, + * and the value must not exceed 15 minutes (PT15M). + * + * @return the notBeforeTimeout value. + */ + public String notBeforeTimeout() { + return this.notBeforeTimeout; + } + + /** + * Set the notBeforeTimeout property: Length of time a Virtual Machine being reimaged or having its OS upgraded will + * have to potentially approve the OS Image Scheduled Event before the event is + * auto approved (timed out). The configuration is specified in ISO 8601 format, + * and the value must not exceed 15 minutes (PT15M). + * + * @param notBeforeTimeout the notBeforeTimeout value to set. + * @return the OSImageNotificationProfile object itself. + */ + public OSImageNotificationProfile withNotBeforeTimeout(String notBeforeTimeout) { + this.notBeforeTimeout = notBeforeTimeout; + return this; + } + + /** + * Get the enable property: Specifies whether the OS Image Scheduled event is enabled or disabled. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Specifies whether the OS Image Scheduled event is enabled or disabled. + * + * @param enable the enable value to set. + * @return the OSImageNotificationProfile object itself. + */ + public OSImageNotificationProfile withEnable(Boolean enable) { + this.enable = enable; + 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("notBeforeTimeout", this.notBeforeTimeout); + jsonWriter.writeBooleanField("enable", this.enable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OSImageNotificationProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OSImageNotificationProfile 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 OSImageNotificationProfile. + */ + public static OSImageNotificationProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OSImageNotificationProfile deserializedOSImageNotificationProfile = new OSImageNotificationProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("notBeforeTimeout".equals(fieldName)) { + deserializedOSImageNotificationProfile.notBeforeTimeout = reader.getString(); + } else if ("enable".equals(fieldName)) { + deserializedOSImageNotificationProfile.enable = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedOSImageNotificationProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperatingSystemTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperatingSystemTypes.java new file mode 100644 index 0000000000000..18bd9fa6b569a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperatingSystemTypes.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * This property allows you to specify the type of the OS that is included in the + * disk if creating a VM from user-image or a specialized VHD. Possible values + * are: **Windows,** **Linux.**. + */ +public final class OperatingSystemTypes extends ExpandableStringEnum { + /** + * Static value Windows for OperatingSystemTypes. + */ + public static final OperatingSystemTypes WINDOWS = fromString("Windows"); + + /** + * Static value Linux for OperatingSystemTypes. + */ + public static final OperatingSystemTypes LINUX = fromString("Linux"); + + /** + * Creates a new instance of OperatingSystemTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperatingSystemTypes() { + } + + /** + * Creates or finds a OperatingSystemTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatingSystemTypes. + */ + public static OperatingSystemTypes fromString(String name) { + return fromString(name, OperatingSystemTypes.class); + } + + /** + * Gets known OperatingSystemTypes values. + * + * @return known OperatingSystemTypes values. + */ + public static Collection values() { + return values(OperatingSystemTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operation.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operation.java new file mode 100644 index 0000000000000..88598bdc29d60 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.resourcemanager.azurefleet.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.azurefleet.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationDisplay.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationDisplay.java new file mode 100644 index 0000000000000..bc198956db1a7 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationListResult.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationListResult.java new file mode 100644 index 0000000000000..a3cdf8730f675 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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.azurefleet.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operations.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operations.java new file mode 100644 index 0000000000000..213f1a2eac637 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Origin.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Origin.java new file mode 100644 index 0000000000000..c251a51e0cf8c --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PatchSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PatchSettings.java new file mode 100644 index 0000000000000..c9fb600788c04 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PatchSettings.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies settings related to VM Guest Patching on Windows. + */ +@Fluent +public final class PatchSettings implements JsonSerializable { + /* + * Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.

Possible values are:

**Manual** - You + * control the application of patches to a virtual machine. You do this by + * applying patches manually inside the VM. In this mode, automatic updates are + * disabled; the property WindowsConfiguration.enableAutomaticUpdates must be + * false

**AutomaticByOS** - The virtual machine will automatically be + * updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + * must be true.

**AutomaticByPlatform** - the virtual machine will + * automatically updated by the platform. The properties provisionVMAgent and + * WindowsConfiguration.enableAutomaticUpdates must be true + */ + private WindowsVMGuestPatchMode patchMode; + + /* + * Enables customers to patch their Azure VMs without requiring a reboot. For + * enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' + * must be set to 'AutomaticByPlatform'. + */ + private Boolean enableHotpatching; + + /* + * Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.

Possible values are:

**ImageDefault** - You + * control the timing of patch assessments on a virtual machine.

+ * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + */ + private WindowsPatchAssessmentMode assessmentMode; + + /* + * Specifies additional settings for patch mode AutomaticByPlatform in VM Guest + * Patching on Windows. + */ + private WindowsVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings; + + /** + * Creates an instance of PatchSettings class. + */ + public PatchSettings() { + } + + /** + * Get the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.<br /><br /> Possible values are:<br /><br /> **Manual** - You + * control the application of patches to a virtual machine. You do this by + * applying patches manually inside the VM. In this mode, automatic updates are + * disabled; the property WindowsConfiguration.enableAutomaticUpdates must be + * false<br /><br /> **AutomaticByOS** - The virtual machine will automatically be + * updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + * must be true. <br /><br /> **AutomaticByPlatform** - the virtual machine will + * automatically updated by the platform. The properties provisionVMAgent and + * WindowsConfiguration.enableAutomaticUpdates must be true. + * + * @return the patchMode value. + */ + public WindowsVMGuestPatchMode patchMode() { + return this.patchMode; + } + + /** + * Set the patchMode property: Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible.<br /><br /> Possible values are:<br /><br /> **Manual** - You + * control the application of patches to a virtual machine. You do this by + * applying patches manually inside the VM. In this mode, automatic updates are + * disabled; the property WindowsConfiguration.enableAutomaticUpdates must be + * false<br /><br /> **AutomaticByOS** - The virtual machine will automatically be + * updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + * must be true. <br /><br /> **AutomaticByPlatform** - the virtual machine will + * automatically updated by the platform. The properties provisionVMAgent and + * WindowsConfiguration.enableAutomaticUpdates must be true. + * + * @param patchMode the patchMode value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withPatchMode(WindowsVMGuestPatchMode patchMode) { + this.patchMode = patchMode; + return this; + } + + /** + * Get the enableHotpatching property: Enables customers to patch their Azure VMs without requiring a reboot. For + * enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' + * must be set to 'AutomaticByPlatform'. + * + * @return the enableHotpatching value. + */ + public Boolean enableHotpatching() { + return this.enableHotpatching; + } + + /** + * Set the enableHotpatching property: Enables customers to patch their Azure VMs without requiring a reboot. For + * enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' + * must be set to 'AutomaticByPlatform'. + * + * @param enableHotpatching the enableHotpatching value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withEnableHotpatching(Boolean enableHotpatching) { + this.enableHotpatching = enableHotpatching; + return this; + } + + /** + * Get the assessmentMode property: Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You + * control the timing of patch assessments on a virtual machine.<br /><br /> + * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + * + * @return the assessmentMode value. + */ + public WindowsPatchAssessmentMode assessmentMode() { + return this.assessmentMode; + } + + /** + * Set the assessmentMode property: Specifies the mode of VM Guest patch assessment for the IaaS virtual + * machine.<br /><br /> Possible values are:<br /><br /> **ImageDefault** - You + * control the timing of patch assessments on a virtual machine.<br /><br /> + * **AutomaticByPlatform** - The platform will trigger periodic patch assessments. + * The property provisionVMAgent must be true. + * + * @param assessmentMode the assessmentMode value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withAssessmentMode(WindowsPatchAssessmentMode assessmentMode) { + this.assessmentMode = assessmentMode; + return this; + } + + /** + * Get the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in + * VM Guest + * Patching on Windows. + * + * @return the automaticByPlatformSettings value. + */ + public WindowsVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings() { + return this.automaticByPlatformSettings; + } + + /** + * Set the automaticByPlatformSettings property: Specifies additional settings for patch mode AutomaticByPlatform in + * VM Guest + * Patching on Windows. + * + * @param automaticByPlatformSettings the automaticByPlatformSettings value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings + withAutomaticByPlatformSettings(WindowsVMGuestPatchAutomaticByPlatformSettings automaticByPlatformSettings) { + this.automaticByPlatformSettings = automaticByPlatformSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (automaticByPlatformSettings() != null) { + automaticByPlatformSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("patchMode", this.patchMode == null ? null : this.patchMode.toString()); + jsonWriter.writeBooleanField("enableHotpatching", this.enableHotpatching); + jsonWriter.writeStringField("assessmentMode", + this.assessmentMode == null ? null : this.assessmentMode.toString()); + jsonWriter.writeJsonField("automaticByPlatformSettings", this.automaticByPlatformSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchSettings 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 PatchSettings. + */ + public static PatchSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchSettings deserializedPatchSettings = new PatchSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("patchMode".equals(fieldName)) { + deserializedPatchSettings.patchMode = WindowsVMGuestPatchMode.fromString(reader.getString()); + } else if ("enableHotpatching".equals(fieldName)) { + deserializedPatchSettings.enableHotpatching = reader.getNullable(JsonReader::getBoolean); + } else if ("assessmentMode".equals(fieldName)) { + deserializedPatchSettings.assessmentMode + = WindowsPatchAssessmentMode.fromString(reader.getString()); + } else if ("automaticByPlatformSettings".equals(fieldName)) { + deserializedPatchSettings.automaticByPlatformSettings + = WindowsVMGuestPatchAutomaticByPlatformSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Plan.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Plan.java new file mode 100644 index 0000000000000..ae9e59d561b4e --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/Plan.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Plan for the resource. + */ +@Fluent +public final class Plan implements JsonSerializable { + /* + * A user defined name of the 3rd Party Artifact that is being procured. + */ + private String name; + + /* + * The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + */ + private String publisher; + + /* + * The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the + * artifact at the time of Data Market onboarding. + */ + private String product; + + /* + * A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + */ + private String promotionCode; + + /* + * The version of the desired product/artifact. + */ + private String version; + + /** + * Creates an instance of Plan class. + */ + public Plan() { + } + + /** + * Get the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The version of the desired product/artifact. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the desired product/artifact. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Plan")); + } + if (publisher() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property product in model Plan")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Plan.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("product", this.product); + jsonWriter.writeStringField("promotionCode", this.promotionCode); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Plan from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Plan 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 Plan. + */ + public static Plan fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Plan deserializedPlan = new Plan(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPlan.name = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedPlan.publisher = reader.getString(); + } else if ("product".equals(fieldName)) { + deserializedPlan.product = reader.getString(); + } else if ("promotionCode".equals(fieldName)) { + deserializedPlan.promotionCode = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedPlan.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPlan; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProtocolTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProtocolTypes.java new file mode 100644 index 0000000000000..c64b1a5fa1ba4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProtocolTypes.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the protocol of WinRM listener. Possible values are: **http,** + * **https.**. + */ +public final class ProtocolTypes extends ExpandableStringEnum { + /** + * Static value Http for ProtocolTypes. + */ + public static final ProtocolTypes HTTP = fromString("Http"); + + /** + * Static value Https for ProtocolTypes. + */ + public static final ProtocolTypes HTTPS = fromString("Https"); + + /** + * Creates a new instance of ProtocolTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProtocolTypes() { + } + + /** + * Creates or finds a ProtocolTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProtocolTypes. + */ + public static ProtocolTypes fromString(String name) { + return fromString(name, ProtocolTypes.class); + } + + /** + * Gets known ProtocolTypes values. + * + * @return known ProtocolTypes values. + */ + public static Collection values() { + return values(ProtocolTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProvisioningState.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProvisioningState.java new file mode 100644 index 0000000000000..25b1dbfd0d981 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Creating for ProvisioningState. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Migrating for ProvisioningState. + */ + public static final ProvisioningState MIGRATING = fromString("Migrating"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProxyAgentSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProxyAgentSettings.java new file mode 100644 index 0000000000000..e46c3c89e3784 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ProxyAgentSettings.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies ProxyAgent settings while creating the virtual machine. Minimum + * api-version: 2023-09-01. + */ +@Fluent +public final class ProxyAgentSettings implements JsonSerializable { + /* + * Specifies whether ProxyAgent feature should be enabled on the virtual machine + * or virtual machine scale set. + */ + private Boolean enabled; + + /* + * Specifies the mode that ProxyAgent will execute on if the feature is enabled. + * ProxyAgent will start to audit or monitor but not enforce access control over + * requests to host endpoints in Audit mode, while in Enforce mode it will enforce + * access control. The default value is Enforce mode. + */ + private Mode mode; + + /* + * Increase the value of this property allows user to reset the key used for + * securing communication channel between guest and host. + */ + private Integer keyIncarnationId; + + /** + * Creates an instance of ProxyAgentSettings class. + */ + public ProxyAgentSettings() { + } + + /** + * Get the enabled property: Specifies whether ProxyAgent feature should be enabled on the virtual machine + * or virtual machine scale set. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Specifies whether ProxyAgent feature should be enabled on the virtual machine + * or virtual machine scale set. + * + * @param enabled the enabled value to set. + * @return the ProxyAgentSettings object itself. + */ + public ProxyAgentSettings withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the mode property: Specifies the mode that ProxyAgent will execute on if the feature is enabled. + * ProxyAgent will start to audit or monitor but not enforce access control over + * requests to host endpoints in Audit mode, while in Enforce mode it will enforce + * access control. The default value is Enforce mode. + * + * @return the mode value. + */ + public Mode mode() { + return this.mode; + } + + /** + * Set the mode property: Specifies the mode that ProxyAgent will execute on if the feature is enabled. + * ProxyAgent will start to audit or monitor but not enforce access control over + * requests to host endpoints in Audit mode, while in Enforce mode it will enforce + * access control. The default value is Enforce mode. + * + * @param mode the mode value to set. + * @return the ProxyAgentSettings object itself. + */ + public ProxyAgentSettings withMode(Mode mode) { + this.mode = mode; + return this; + } + + /** + * Get the keyIncarnationId property: Increase the value of this property allows user to reset the key used for + * securing communication channel between guest and host. + * + * @return the keyIncarnationId value. + */ + public Integer keyIncarnationId() { + return this.keyIncarnationId; + } + + /** + * Set the keyIncarnationId property: Increase the value of this property allows user to reset the key used for + * securing communication channel between guest and host. + * + * @param keyIncarnationId the keyIncarnationId value to set. + * @return the ProxyAgentSettings object itself. + */ + public ProxyAgentSettings withKeyIncarnationId(Integer keyIncarnationId) { + this.keyIncarnationId = keyIncarnationId; + 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.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + jsonWriter.writeNumberField("keyIncarnationId", this.keyIncarnationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProxyAgentSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProxyAgentSettings 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 ProxyAgentSettings. + */ + public static ProxyAgentSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProxyAgentSettings deserializedProxyAgentSettings = new ProxyAgentSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedProxyAgentSettings.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("mode".equals(fieldName)) { + deserializedProxyAgentSettings.mode = Mode.fromString(reader.getString()); + } else if ("keyIncarnationId".equals(fieldName)) { + deserializedProxyAgentSettings.keyIncarnationId = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedProxyAgentSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSku.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSku.java new file mode 100644 index 0000000000000..f6d7a0e134984 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSku.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the public IP Sku. It can only be set with OrchestrationMode as + * Flexible. + */ +@Fluent +public final class PublicIpAddressSku implements JsonSerializable { + /* + * Specify public IP sku name + */ + private PublicIpAddressSkuName name; + + /* + * Specify public IP sku tier + */ + private PublicIpAddressSkuTier tier; + + /** + * Creates an instance of PublicIpAddressSku class. + */ + public PublicIpAddressSku() { + } + + /** + * Get the name property: Specify public IP sku name. + * + * @return the name value. + */ + public PublicIpAddressSkuName name() { + return this.name; + } + + /** + * Set the name property: Specify public IP sku name. + * + * @param name the name value to set. + * @return the PublicIpAddressSku object itself. + */ + public PublicIpAddressSku withName(PublicIpAddressSkuName name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Specify public IP sku tier. + * + * @return the tier value. + */ + public PublicIpAddressSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: Specify public IP sku tier. + * + * @param tier the tier value to set. + * @return the PublicIpAddressSku object itself. + */ + public PublicIpAddressSku withTier(PublicIpAddressSkuTier tier) { + this.tier = tier; + 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("name", this.name == null ? null : this.name.toString()); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublicIpAddressSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublicIpAddressSku 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 PublicIpAddressSku. + */ + public static PublicIpAddressSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PublicIpAddressSku deserializedPublicIpAddressSku = new PublicIpAddressSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPublicIpAddressSku.name = PublicIpAddressSkuName.fromString(reader.getString()); + } else if ("tier".equals(fieldName)) { + deserializedPublicIpAddressSku.tier = PublicIpAddressSkuTier.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPublicIpAddressSku; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuName.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuName.java new file mode 100644 index 0000000000000..cf8cb01b5dd7c --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specify public IP sku name. + */ +public final class PublicIpAddressSkuName extends ExpandableStringEnum { + /** + * Static value Basic for PublicIpAddressSkuName. + */ + public static final PublicIpAddressSkuName BASIC = fromString("Basic"); + + /** + * Static value Standard for PublicIpAddressSkuName. + */ + public static final PublicIpAddressSkuName STANDARD = fromString("Standard"); + + /** + * Creates a new instance of PublicIpAddressSkuName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicIpAddressSkuName() { + } + + /** + * Creates or finds a PublicIpAddressSkuName from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicIpAddressSkuName. + */ + public static PublicIpAddressSkuName fromString(String name) { + return fromString(name, PublicIpAddressSkuName.class); + } + + /** + * Gets known PublicIpAddressSkuName values. + * + * @return known PublicIpAddressSkuName values. + */ + public static Collection values() { + return values(PublicIpAddressSkuName.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuTier.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuTier.java new file mode 100644 index 0000000000000..a1b58c1828940 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/PublicIpAddressSkuTier.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specify public IP sku tier. + */ +public final class PublicIpAddressSkuTier extends ExpandableStringEnum { + /** + * Static value Regional for PublicIpAddressSkuTier. + */ + public static final PublicIpAddressSkuTier REGIONAL = fromString("Regional"); + + /** + * Static value Global for PublicIpAddressSkuTier. + */ + public static final PublicIpAddressSkuTier GLOBAL = fromString("Global"); + + /** + * Creates a new instance of PublicIpAddressSkuTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicIpAddressSkuTier() { + } + + /** + * Creates or finds a PublicIpAddressSkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicIpAddressSkuTier. + */ + public static PublicIpAddressSkuTier fromString(String name) { + return fromString(name, PublicIpAddressSkuTier.class); + } + + /** + * Gets known PublicIpAddressSkuTier values. + * + * @return known PublicIpAddressSkuTier values. + */ + public static Collection values() { + return values(PublicIpAddressSkuTier.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityAllocationStrategy.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityAllocationStrategy.java new file mode 100644 index 0000000000000..110c2fe087ca1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityAllocationStrategy.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Regular VM Allocation strategy types for Compute Fleet. + */ +public final class RegularPriorityAllocationStrategy extends ExpandableStringEnum { + /** + * Static value LowestPrice for RegularPriorityAllocationStrategy. + */ + public static final RegularPriorityAllocationStrategy LOWEST_PRICE = fromString("LowestPrice"); + + /** + * Static value Prioritized for RegularPriorityAllocationStrategy. + */ + public static final RegularPriorityAllocationStrategy PRIORITIZED = fromString("Prioritized"); + + /** + * Creates a new instance of RegularPriorityAllocationStrategy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RegularPriorityAllocationStrategy() { + } + + /** + * Creates or finds a RegularPriorityAllocationStrategy from its string representation. + * + * @param name a name to look for. + * @return the corresponding RegularPriorityAllocationStrategy. + */ + public static RegularPriorityAllocationStrategy fromString(String name) { + return fromString(name, RegularPriorityAllocationStrategy.class); + } + + /** + * Gets known RegularPriorityAllocationStrategy values. + * + * @return known RegularPriorityAllocationStrategy values. + */ + public static Collection values() { + return values(RegularPriorityAllocationStrategy.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityProfile.java new file mode 100644 index 0000000000000..18d39af2e4c98 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/RegularPriorityProfile.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Configuration Options for Regular instances in Compute Fleet. + */ +@Fluent +public final class RegularPriorityProfile implements JsonSerializable { + /* + * Total capacity to achieve. It is currently in terms of number of VMs. + */ + private Integer capacity; + + /* + * Minimum capacity to achieve which cannot be updated. If we will not be able to "guarantee" minimum capacity, we + * will reject the request in the sync path itself. + */ + private Integer minCapacity; + + /* + * Allocation strategy to follow when determining the VM sizes distribution for Regular VMs. + */ + private RegularPriorityAllocationStrategy allocationStrategy; + + /** + * Creates an instance of RegularPriorityProfile class. + */ + public RegularPriorityProfile() { + } + + /** + * Get the capacity property: Total capacity to achieve. It is currently in terms of number of VMs. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Total capacity to achieve. It is currently in terms of number of VMs. + * + * @param capacity the capacity value to set. + * @return the RegularPriorityProfile object itself. + */ + public RegularPriorityProfile withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the minCapacity property: Minimum capacity to achieve which cannot be updated. If we will not be able to + * "guarantee" minimum capacity, we will reject the request in the sync path itself. + * + * @return the minCapacity value. + */ + public Integer minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimum capacity to achieve which cannot be updated. If we will not be able to + * "guarantee" minimum capacity, we will reject the request in the sync path itself. + * + * @param minCapacity the minCapacity value to set. + * @return the RegularPriorityProfile object itself. + */ + public RegularPriorityProfile withMinCapacity(Integer minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the allocationStrategy property: Allocation strategy to follow when determining the VM sizes distribution for + * Regular VMs. + * + * @return the allocationStrategy value. + */ + public RegularPriorityAllocationStrategy allocationStrategy() { + return this.allocationStrategy; + } + + /** + * Set the allocationStrategy property: Allocation strategy to follow when determining the VM sizes distribution for + * Regular VMs. + * + * @param allocationStrategy the allocationStrategy value to set. + * @return the RegularPriorityProfile object itself. + */ + public RegularPriorityProfile withAllocationStrategy(RegularPriorityAllocationStrategy allocationStrategy) { + this.allocationStrategy = allocationStrategy; + 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.writeNumberField("capacity", this.capacity); + jsonWriter.writeNumberField("minCapacity", this.minCapacity); + jsonWriter.writeStringField("allocationStrategy", + this.allocationStrategy == null ? null : this.allocationStrategy.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegularPriorityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegularPriorityProfile 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 RegularPriorityProfile. + */ + public static RegularPriorityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegularPriorityProfile deserializedRegularPriorityProfile = new RegularPriorityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("capacity".equals(fieldName)) { + deserializedRegularPriorityProfile.capacity = reader.getNullable(JsonReader::getInt); + } else if ("minCapacity".equals(fieldName)) { + deserializedRegularPriorityProfile.minCapacity = reader.getNullable(JsonReader::getInt); + } else if ("allocationStrategy".equals(fieldName)) { + deserializedRegularPriorityProfile.allocationStrategy + = RegularPriorityAllocationStrategy.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRegularPriorityProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ResourcePlanUpdate.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ResourcePlanUpdate.java new file mode 100644 index 0000000000000..c00f9f077dcb6 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ResourcePlanUpdate.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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 template for adding optional properties. + */ +@Fluent +public final class ResourcePlanUpdate implements JsonSerializable { + /* + * A user defined name of the 3rd Party Artifact that is being procured. + */ + private String name; + + /* + * The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + */ + private String publisher; + + /* + * The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the + * artifact at the time of Data Market onboarding. + */ + private String product; + + /* + * A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + */ + private String promotionCode; + + /* + * The version of the desired product/artifact. + */ + private String version; + + /** + * Creates an instance of ResourcePlanUpdate class. + */ + public ResourcePlanUpdate() { + } + + /** + * Get the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @param name the name value to set. + * @return the ResourcePlanUpdate object itself. + */ + public ResourcePlanUpdate withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @param publisher the publisher value to set. + * @return the ResourcePlanUpdate object itself. + */ + public ResourcePlanUpdate withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @param product the product value to set. + * @return the ResourcePlanUpdate object itself. + */ + public ResourcePlanUpdate withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @param promotionCode the promotionCode value to set. + * @return the ResourcePlanUpdate object itself. + */ + public ResourcePlanUpdate withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The version of the desired product/artifact. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the desired product/artifact. + * + * @param version the version value to set. + * @return the ResourcePlanUpdate object itself. + */ + public ResourcePlanUpdate withVersion(String version) { + this.version = version; + 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("name", this.name); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("product", this.product); + jsonWriter.writeStringField("promotionCode", this.promotionCode); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourcePlanUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourcePlanUpdate 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 ResourcePlanUpdate. + */ + public static ResourcePlanUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourcePlanUpdate deserializedResourcePlanUpdate = new ResourcePlanUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedResourcePlanUpdate.name = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedResourcePlanUpdate.publisher = reader.getString(); + } else if ("product".equals(fieldName)) { + deserializedResourcePlanUpdate.product = reader.getString(); + } else if ("promotionCode".equals(fieldName)) { + deserializedResourcePlanUpdate.promotionCode = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedResourcePlanUpdate.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourcePlanUpdate; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ScheduledEventsProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ScheduledEventsProfile.java new file mode 100644 index 0000000000000..8e71634ccb036 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ScheduledEventsProfile.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies Scheduled Event related configurations. + */ +@Fluent +public final class ScheduledEventsProfile implements JsonSerializable { + /* + * Specifies Terminate Scheduled Event related configurations. + */ + private TerminateNotificationProfile terminateNotificationProfile; + + /* + * Specifies OS Image Scheduled Event related configurations. + */ + private OSImageNotificationProfile osImageNotificationProfile; + + /** + * Creates an instance of ScheduledEventsProfile class. + */ + public ScheduledEventsProfile() { + } + + /** + * Get the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations. + * + * @return the terminateNotificationProfile value. + */ + public TerminateNotificationProfile terminateNotificationProfile() { + return this.terminateNotificationProfile; + } + + /** + * Set the terminateNotificationProfile property: Specifies Terminate Scheduled Event related configurations. + * + * @param terminateNotificationProfile the terminateNotificationProfile value to set. + * @return the ScheduledEventsProfile object itself. + */ + public ScheduledEventsProfile + withTerminateNotificationProfile(TerminateNotificationProfile terminateNotificationProfile) { + this.terminateNotificationProfile = terminateNotificationProfile; + return this; + } + + /** + * Get the osImageNotificationProfile property: Specifies OS Image Scheduled Event related configurations. + * + * @return the osImageNotificationProfile value. + */ + public OSImageNotificationProfile osImageNotificationProfile() { + return this.osImageNotificationProfile; + } + + /** + * Set the osImageNotificationProfile property: Specifies OS Image Scheduled Event related configurations. + * + * @param osImageNotificationProfile the osImageNotificationProfile value to set. + * @return the ScheduledEventsProfile object itself. + */ + public ScheduledEventsProfile + withOsImageNotificationProfile(OSImageNotificationProfile osImageNotificationProfile) { + this.osImageNotificationProfile = osImageNotificationProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (terminateNotificationProfile() != null) { + terminateNotificationProfile().validate(); + } + if (osImageNotificationProfile() != null) { + osImageNotificationProfile().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("terminateNotificationProfile", this.terminateNotificationProfile); + jsonWriter.writeJsonField("osImageNotificationProfile", this.osImageNotificationProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScheduledEventsProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScheduledEventsProfile 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 ScheduledEventsProfile. + */ + public static ScheduledEventsProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScheduledEventsProfile deserializedScheduledEventsProfile = new ScheduledEventsProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("terminateNotificationProfile".equals(fieldName)) { + deserializedScheduledEventsProfile.terminateNotificationProfile + = TerminateNotificationProfile.fromJson(reader); + } else if ("osImageNotificationProfile".equals(fieldName)) { + deserializedScheduledEventsProfile.osImageNotificationProfile + = OSImageNotificationProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScheduledEventsProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityEncryptionTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityEncryptionTypes.java new file mode 100644 index 0000000000000..2306150de02ab --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityEncryptionTypes.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the EncryptionType of the managed disk. + * **Note:** It can be set for only Confidential VMs. + */ +public final class SecurityEncryptionTypes extends ExpandableStringEnum { + /** + * Static value VMGuestStateOnly for SecurityEncryptionTypes. + */ + public static final SecurityEncryptionTypes VMGUEST_STATE_ONLY = fromString("VMGuestStateOnly"); + + /** + * Static value DiskWithVMGuestState for SecurityEncryptionTypes. + */ + public static final SecurityEncryptionTypes DISK_WITH_VMGUEST_STATE = fromString("DiskWithVMGuestState"); + + /** + * Static value NonPersistedTPM for SecurityEncryptionTypes. + */ + public static final SecurityEncryptionTypes NON_PERSISTED_TPM = fromString("NonPersistedTPM"); + + /** + * Creates a new instance of SecurityEncryptionTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityEncryptionTypes() { + } + + /** + * Creates or finds a SecurityEncryptionTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityEncryptionTypes. + */ + public static SecurityEncryptionTypes fromString(String name) { + return fromString(name, SecurityEncryptionTypes.class); + } + + /** + * Gets known SecurityEncryptionTypes values. + * + * @return known SecurityEncryptionTypes values. + */ + public static Collection values() { + return values(SecurityEncryptionTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityPostureReference.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityPostureReference.java new file mode 100644 index 0000000000000..03991a7a27499 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityPostureReference.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the security posture to be used for all virtual machines in the scale + * set. Minimum api-version: 2023-03-01. + */ +@Fluent +public final class SecurityPostureReference implements JsonSerializable { + /* + * The security posture reference id in the form of + * /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{ + * major.*}|latest + */ + private String id; + + /* + * List of virtual machine extension names to exclude when applying the security + * posture. + */ + private List excludeExtensions; + + /* + * Whether the security posture can be overridden by the user. + */ + private Boolean isOverridable; + + /** + * Creates an instance of SecurityPostureReference class. + */ + public SecurityPostureReference() { + } + + /** + * Get the id property: The security posture reference id in the form of + * /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The security posture reference id in the form of + * /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest. + * + * @param id the id value to set. + * @return the SecurityPostureReference object itself. + */ + public SecurityPostureReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the excludeExtensions property: List of virtual machine extension names to exclude when applying the security + * posture. + * + * @return the excludeExtensions value. + */ + public List excludeExtensions() { + return this.excludeExtensions; + } + + /** + * Set the excludeExtensions property: List of virtual machine extension names to exclude when applying the security + * posture. + * + * @param excludeExtensions the excludeExtensions value to set. + * @return the SecurityPostureReference object itself. + */ + public SecurityPostureReference withExcludeExtensions(List excludeExtensions) { + this.excludeExtensions = excludeExtensions; + return this; + } + + /** + * Get the isOverridable property: Whether the security posture can be overridden by the user. + * + * @return the isOverridable value. + */ + public Boolean isOverridable() { + return this.isOverridable; + } + + /** + * Set the isOverridable property: Whether the security posture can be overridden by the user. + * + * @param isOverridable the isOverridable value to set. + * @return the SecurityPostureReference object itself. + */ + public SecurityPostureReference withIsOverridable(Boolean isOverridable) { + this.isOverridable = isOverridable; + 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("id", this.id); + jsonWriter.writeArrayField("excludeExtensions", this.excludeExtensions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isOverridable", this.isOverridable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityPostureReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityPostureReference 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 SecurityPostureReference. + */ + public static SecurityPostureReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityPostureReference deserializedSecurityPostureReference = new SecurityPostureReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityPostureReference.id = reader.getString(); + } else if ("excludeExtensions".equals(fieldName)) { + List excludeExtensions = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityPostureReference.excludeExtensions = excludeExtensions; + } else if ("isOverridable".equals(fieldName)) { + deserializedSecurityPostureReference.isOverridable = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityPostureReference; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityProfile.java new file mode 100644 index 0000000000000..3cbd7567cf9e0 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityProfile.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the Security profile settings for the virtual machine or virtual + * machine scale set. + */ +@Fluent +public final class SecurityProfile implements JsonSerializable { + /* + * Specifies the security settings like secure boot and vTPM used while creating + * the virtual machine. Minimum api-version: 2020-12-01. + */ + private UefiSettings uefiSettings; + + /* + * This property can be used by user in the request to enable or disable the Host + * Encryption for the virtual machine or virtual machine scale set. This will + * enable the encryption for all the disks including Resource/Temp disk at host + * itself. The default behavior is: The Encryption at host will be disabled unless + * this property is set to true for the resource. + */ + private Boolean encryptionAtHost; + + /* + * Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. The default behavior is: UefiSettings + * will not be enabled unless this property is set. + */ + private SecurityTypes securityType; + + /* + * Specifies the Managed Identity used by ADE to get access token for keyvault + * operations. + */ + private EncryptionIdentity encryptionIdentity; + + /* + * Specifies ProxyAgent settings while creating the virtual machine. Minimum + * api-version: 2023-09-01. + */ + private ProxyAgentSettings proxyAgentSettings; + + /** + * Creates an instance of SecurityProfile class. + */ + public SecurityProfile() { + } + + /** + * Get the uefiSettings property: Specifies the security settings like secure boot and vTPM used while creating + * the virtual machine. Minimum api-version: 2020-12-01. + * + * @return the uefiSettings value. + */ + public UefiSettings uefiSettings() { + return this.uefiSettings; + } + + /** + * Set the uefiSettings property: Specifies the security settings like secure boot and vTPM used while creating + * the virtual machine. Minimum api-version: 2020-12-01. + * + * @param uefiSettings the uefiSettings value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withUefiSettings(UefiSettings uefiSettings) { + this.uefiSettings = uefiSettings; + return this; + } + + /** + * Get the encryptionAtHost property: This property can be used by user in the request to enable or disable the Host + * Encryption for the virtual machine or virtual machine scale set. This will + * enable the encryption for all the disks including Resource/Temp disk at host + * itself. The default behavior is: The Encryption at host will be disabled unless + * this property is set to true for the resource. + * + * @return the encryptionAtHost value. + */ + public Boolean encryptionAtHost() { + return this.encryptionAtHost; + } + + /** + * Set the encryptionAtHost property: This property can be used by user in the request to enable or disable the Host + * Encryption for the virtual machine or virtual machine scale set. This will + * enable the encryption for all the disks including Resource/Temp disk at host + * itself. The default behavior is: The Encryption at host will be disabled unless + * this property is set to true for the resource. + * + * @param encryptionAtHost the encryptionAtHost value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withEncryptionAtHost(Boolean encryptionAtHost) { + this.encryptionAtHost = encryptionAtHost; + return this; + } + + /** + * Get the securityType property: Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. The default behavior is: UefiSettings + * will not be enabled unless this property is set. + * + * @return the securityType value. + */ + public SecurityTypes securityType() { + return this.securityType; + } + + /** + * Set the securityType property: Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. The default behavior is: UefiSettings + * will not be enabled unless this property is set. + * + * @param securityType the securityType value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withSecurityType(SecurityTypes securityType) { + this.securityType = securityType; + return this; + } + + /** + * Get the encryptionIdentity property: Specifies the Managed Identity used by ADE to get access token for keyvault + * operations. + * + * @return the encryptionIdentity value. + */ + public EncryptionIdentity encryptionIdentity() { + return this.encryptionIdentity; + } + + /** + * Set the encryptionIdentity property: Specifies the Managed Identity used by ADE to get access token for keyvault + * operations. + * + * @param encryptionIdentity the encryptionIdentity value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withEncryptionIdentity(EncryptionIdentity encryptionIdentity) { + this.encryptionIdentity = encryptionIdentity; + return this; + } + + /** + * Get the proxyAgentSettings property: Specifies ProxyAgent settings while creating the virtual machine. Minimum + * api-version: 2023-09-01. + * + * @return the proxyAgentSettings value. + */ + public ProxyAgentSettings proxyAgentSettings() { + return this.proxyAgentSettings; + } + + /** + * Set the proxyAgentSettings property: Specifies ProxyAgent settings while creating the virtual machine. Minimum + * api-version: 2023-09-01. + * + * @param proxyAgentSettings the proxyAgentSettings value to set. + * @return the SecurityProfile object itself. + */ + public SecurityProfile withProxyAgentSettings(ProxyAgentSettings proxyAgentSettings) { + this.proxyAgentSettings = proxyAgentSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uefiSettings() != null) { + uefiSettings().validate(); + } + if (encryptionIdentity() != null) { + encryptionIdentity().validate(); + } + if (proxyAgentSettings() != null) { + proxyAgentSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("uefiSettings", this.uefiSettings); + jsonWriter.writeBooleanField("encryptionAtHost", this.encryptionAtHost); + jsonWriter.writeStringField("securityType", this.securityType == null ? null : this.securityType.toString()); + jsonWriter.writeJsonField("encryptionIdentity", this.encryptionIdentity); + jsonWriter.writeJsonField("proxyAgentSettings", this.proxyAgentSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityProfile 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 SecurityProfile. + */ + public static SecurityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityProfile deserializedSecurityProfile = new SecurityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uefiSettings".equals(fieldName)) { + deserializedSecurityProfile.uefiSettings = UefiSettings.fromJson(reader); + } else if ("encryptionAtHost".equals(fieldName)) { + deserializedSecurityProfile.encryptionAtHost = reader.getNullable(JsonReader::getBoolean); + } else if ("securityType".equals(fieldName)) { + deserializedSecurityProfile.securityType = SecurityTypes.fromString(reader.getString()); + } else if ("encryptionIdentity".equals(fieldName)) { + deserializedSecurityProfile.encryptionIdentity = EncryptionIdentity.fromJson(reader); + } else if ("proxyAgentSettings".equals(fieldName)) { + deserializedSecurityProfile.proxyAgentSettings = ProxyAgentSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityTypes.java new file mode 100644 index 0000000000000..067411f24fb08 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SecurityTypes.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the SecurityType of the virtual machine. It has to be set to any + * specified value to enable UefiSettings. The default behavior is: UefiSettings + * will not be enabled unless this property is set. + */ +public final class SecurityTypes extends ExpandableStringEnum { + /** + * Static value TrustedLaunch for SecurityTypes. + */ + public static final SecurityTypes TRUSTED_LAUNCH = fromString("TrustedLaunch"); + + /** + * Static value ConfidentialVM for SecurityTypes. + */ + public static final SecurityTypes CONFIDENTIAL_VM = fromString("ConfidentialVM"); + + /** + * Creates a new instance of SecurityTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityTypes() { + } + + /** + * Creates or finds a SecurityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityTypes. + */ + public static SecurityTypes fromString(String name) { + return fromString(name, SecurityTypes.class); + } + + /** + * Gets known SecurityTypes values. + * + * @return known SecurityTypes values. + */ + public static Collection values() { + return values(SecurityTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ServiceArtifactReference.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ServiceArtifactReference.java new file mode 100644 index 0000000000000..0ff71cf424252 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/ServiceArtifactReference.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the service artifact reference id used to set same image version for + * all virtual machines in the scale set when using 'latest' image version. + * Minimum api-version: 2022-11-01. + */ +@Fluent +public final class ServiceArtifactReference implements JsonSerializable { + /* + * The service artifact reference id in the form of + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName + * }/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} + */ + private String id; + + /** + * Creates an instance of ServiceArtifactReference class. + */ + public ServiceArtifactReference() { + } + + /** + * Get the id property: The service artifact reference id in the form of + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The service artifact reference id in the form of + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}. + * + * @param id the id value to set. + * @return the ServiceArtifactReference object itself. + */ + public ServiceArtifactReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceArtifactReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceArtifactReference 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 ServiceArtifactReference. + */ + public static ServiceArtifactReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceArtifactReference deserializedServiceArtifactReference = new ServiceArtifactReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServiceArtifactReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceArtifactReference; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SettingNames.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SettingNames.java new file mode 100644 index 0000000000000..907315d7500c6 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SettingNames.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the name of the setting to which the content applies. Possible values + * are: FirstLogonCommands and AutoLogon. + */ +public final class SettingNames extends ExpandableStringEnum { + /** + * Static value AutoLogon for SettingNames. + */ + public static final SettingNames AUTO_LOGON = fromString("AutoLogon"); + + /** + * Static value FirstLogonCommands for SettingNames. + */ + public static final SettingNames FIRST_LOGON_COMMANDS = fromString("FirstLogonCommands"); + + /** + * Creates a new instance of SettingNames value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SettingNames() { + } + + /** + * Creates or finds a SettingNames from its string representation. + * + * @param name a name to look for. + * @return the corresponding SettingNames. + */ + public static SettingNames fromString(String name) { + return fromString(name, SettingNames.class); + } + + /** + * Gets known SettingNames values. + * + * @return known SettingNames values. + */ + public static Collection values() { + return values(SettingNames.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotAllocationStrategy.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotAllocationStrategy.java new file mode 100644 index 0000000000000..9398cc7c4c66d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotAllocationStrategy.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Spot allocation strategy types for Compute Fleet. + */ +public final class SpotAllocationStrategy extends ExpandableStringEnum { + /** + * Static value PriceCapacityOptimized for SpotAllocationStrategy. + */ + public static final SpotAllocationStrategy PRICE_CAPACITY_OPTIMIZED = fromString("PriceCapacityOptimized"); + + /** + * Static value LowestPrice for SpotAllocationStrategy. + */ + public static final SpotAllocationStrategy LOWEST_PRICE = fromString("LowestPrice"); + + /** + * Static value CapacityOptimized for SpotAllocationStrategy. + */ + public static final SpotAllocationStrategy CAPACITY_OPTIMIZED = fromString("CapacityOptimized"); + + /** + * Creates a new instance of SpotAllocationStrategy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SpotAllocationStrategy() { + } + + /** + * Creates or finds a SpotAllocationStrategy from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpotAllocationStrategy. + */ + public static SpotAllocationStrategy fromString(String name) { + return fromString(name, SpotAllocationStrategy.class); + } + + /** + * Gets known SpotAllocationStrategy values. + * + * @return known SpotAllocationStrategy values. + */ + public static Collection values() { + return values(SpotAllocationStrategy.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotPriorityProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotPriorityProfile.java new file mode 100644 index 0000000000000..7dadd5845fec2 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SpotPriorityProfile.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Configuration Options for Spot instances in Compute Fleet. + */ +@Fluent +public final class SpotPriorityProfile implements JsonSerializable { + /* + * Total capacity to achieve. It is currently in terms of number of VMs. + */ + private Integer capacity; + + /* + * Minimum capacity to achieve which cannot be updated. If we will not be able to "guarantee" minimum capacity, we + * will reject the request in the sync path itself. + */ + private Integer minCapacity; + + /* + * Price per hour of each Spot VM will never exceed this. + */ + private Float maxPricePerVM; + + /* + * Eviction Policy to follow when evicting Spot VMs. + */ + private EvictionPolicy evictionPolicy; + + /* + * Allocation strategy to follow when determining the VM sizes distribution for Spot VMs. + */ + private SpotAllocationStrategy allocationStrategy; + + /* + * Flag to enable/disable continuous goal seeking for the desired capacity and restoration of evicted Spot VMs. + * If maintain is enabled, AzureFleetRP will use all VM sizes in vmSizesProfile to create new VMs (if VMs are + * evicted deleted) + * or update existing VMs with new VM sizes (if VMs are evicted deallocated or failed to allocate due to capacity + * constraint) in order to achieve the desired capacity. + * Maintain is enabled by default. + */ + private Boolean maintain; + + /** + * Creates an instance of SpotPriorityProfile class. + */ + public SpotPriorityProfile() { + } + + /** + * Get the capacity property: Total capacity to achieve. It is currently in terms of number of VMs. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Total capacity to achieve. It is currently in terms of number of VMs. + * + * @param capacity the capacity value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the minCapacity property: Minimum capacity to achieve which cannot be updated. If we will not be able to + * "guarantee" minimum capacity, we will reject the request in the sync path itself. + * + * @return the minCapacity value. + */ + public Integer minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimum capacity to achieve which cannot be updated. If we will not be able to + * "guarantee" minimum capacity, we will reject the request in the sync path itself. + * + * @param minCapacity the minCapacity value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withMinCapacity(Integer minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the maxPricePerVM property: Price per hour of each Spot VM will never exceed this. + * + * @return the maxPricePerVM value. + */ + public Float maxPricePerVM() { + return this.maxPricePerVM; + } + + /** + * Set the maxPricePerVM property: Price per hour of each Spot VM will never exceed this. + * + * @param maxPricePerVM the maxPricePerVM value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withMaxPricePerVM(Float maxPricePerVM) { + this.maxPricePerVM = maxPricePerVM; + return this; + } + + /** + * Get the evictionPolicy property: Eviction Policy to follow when evicting Spot VMs. + * + * @return the evictionPolicy value. + */ + public EvictionPolicy evictionPolicy() { + return this.evictionPolicy; + } + + /** + * Set the evictionPolicy property: Eviction Policy to follow when evicting Spot VMs. + * + * @param evictionPolicy the evictionPolicy value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withEvictionPolicy(EvictionPolicy evictionPolicy) { + this.evictionPolicy = evictionPolicy; + return this; + } + + /** + * Get the allocationStrategy property: Allocation strategy to follow when determining the VM sizes distribution for + * Spot VMs. + * + * @return the allocationStrategy value. + */ + public SpotAllocationStrategy allocationStrategy() { + return this.allocationStrategy; + } + + /** + * Set the allocationStrategy property: Allocation strategy to follow when determining the VM sizes distribution for + * Spot VMs. + * + * @param allocationStrategy the allocationStrategy value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withAllocationStrategy(SpotAllocationStrategy allocationStrategy) { + this.allocationStrategy = allocationStrategy; + return this; + } + + /** + * Get the maintain property: Flag to enable/disable continuous goal seeking for the desired capacity and + * restoration of evicted Spot VMs. + * If maintain is enabled, AzureFleetRP will use all VM sizes in vmSizesProfile to create new VMs (if VMs are + * evicted deleted) + * or update existing VMs with new VM sizes (if VMs are evicted deallocated or failed to allocate due to capacity + * constraint) in order to achieve the desired capacity. + * Maintain is enabled by default. + * + * @return the maintain value. + */ + public Boolean maintain() { + return this.maintain; + } + + /** + * Set the maintain property: Flag to enable/disable continuous goal seeking for the desired capacity and + * restoration of evicted Spot VMs. + * If maintain is enabled, AzureFleetRP will use all VM sizes in vmSizesProfile to create new VMs (if VMs are + * evicted deleted) + * or update existing VMs with new VM sizes (if VMs are evicted deallocated or failed to allocate due to capacity + * constraint) in order to achieve the desired capacity. + * Maintain is enabled by default. + * + * @param maintain the maintain value to set. + * @return the SpotPriorityProfile object itself. + */ + public SpotPriorityProfile withMaintain(Boolean maintain) { + this.maintain = maintain; + 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.writeNumberField("capacity", this.capacity); + jsonWriter.writeNumberField("minCapacity", this.minCapacity); + jsonWriter.writeNumberField("maxPricePerVM", this.maxPricePerVM); + jsonWriter.writeStringField("evictionPolicy", + this.evictionPolicy == null ? null : this.evictionPolicy.toString()); + jsonWriter.writeStringField("allocationStrategy", + this.allocationStrategy == null ? null : this.allocationStrategy.toString()); + jsonWriter.writeBooleanField("maintain", this.maintain); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpotPriorityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpotPriorityProfile 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 SpotPriorityProfile. + */ + public static SpotPriorityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SpotPriorityProfile deserializedSpotPriorityProfile = new SpotPriorityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("capacity".equals(fieldName)) { + deserializedSpotPriorityProfile.capacity = reader.getNullable(JsonReader::getInt); + } else if ("minCapacity".equals(fieldName)) { + deserializedSpotPriorityProfile.minCapacity = reader.getNullable(JsonReader::getInt); + } else if ("maxPricePerVM".equals(fieldName)) { + deserializedSpotPriorityProfile.maxPricePerVM = reader.getNullable(JsonReader::getFloat); + } else if ("evictionPolicy".equals(fieldName)) { + deserializedSpotPriorityProfile.evictionPolicy = EvictionPolicy.fromString(reader.getString()); + } else if ("allocationStrategy".equals(fieldName)) { + deserializedSpotPriorityProfile.allocationStrategy + = SpotAllocationStrategy.fromString(reader.getString()); + } else if ("maintain".equals(fieldName)) { + deserializedSpotPriorityProfile.maintain = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSpotPriorityProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshConfiguration.java new file mode 100644 index 0000000000000..c791a53ebf315 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * SSH configuration for Linux based VMs running on Azure. + */ +@Fluent +public final class SshConfiguration implements JsonSerializable { + /* + * The list of SSH public keys used to authenticate with linux based VMs. + */ + private List publicKeys; + + /** + * Creates an instance of SshConfiguration class. + */ + public SshConfiguration() { + } + + /** + * Get the publicKeys property: The list of SSH public keys used to authenticate with linux based VMs. + * + * @return the publicKeys value. + */ + public List publicKeys() { + return this.publicKeys; + } + + /** + * Set the publicKeys property: The list of SSH public keys used to authenticate with linux based VMs. + * + * @param publicKeys the publicKeys value to set. + * @return the SshConfiguration object itself. + */ + public SshConfiguration withPublicKeys(List publicKeys) { + this.publicKeys = publicKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publicKeys() != null) { + publicKeys().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("publicKeys", this.publicKeys, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SshConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SshConfiguration 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 SshConfiguration. + */ + public static SshConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SshConfiguration deserializedSshConfiguration = new SshConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publicKeys".equals(fieldName)) { + List publicKeys = reader.readArray(reader1 -> SshPublicKey.fromJson(reader1)); + deserializedSshConfiguration.publicKeys = publicKeys; + } else { + reader.skipChildren(); + } + } + + return deserializedSshConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshPublicKey.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshPublicKey.java new file mode 100644 index 0000000000000..99e59f64e5ab0 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/SshPublicKey.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Contains information about SSH certificate public key and the path on the Linux + * VM where the public key is placed. + */ +@Fluent +public final class SshPublicKey implements JsonSerializable { + /* + * Specifies the full path on the created VM where ssh public key is stored. If + * the file already exists, the specified key is appended to the file. Example: + * /home/user/.ssh/authorized_keys + */ + private String path; + + /* + * SSH public key certificate used to authenticate with the VM through ssh. The + * key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, + * see [Create SSH keys on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + */ + private String keyData; + + /** + * Creates an instance of SshPublicKey class. + */ + public SshPublicKey() { + } + + /** + * Get the path property: Specifies the full path on the created VM where ssh public key is stored. If + * the file already exists, the specified key is appended to the file. Example: + * /home/user/.ssh/authorized_keys. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: Specifies the full path on the created VM where ssh public key is stored. If + * the file already exists, the specified key is appended to the file. Example: + * /home/user/.ssh/authorized_keys. + * + * @param path the path value to set. + * @return the SshPublicKey object itself. + */ + public SshPublicKey withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the keyData property: SSH public key certificate used to authenticate with the VM through ssh. The + * key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, + * see [Create SSH keys on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + * + * @return the keyData value. + */ + public String keyData() { + return this.keyData; + } + + /** + * Set the keyData property: SSH public key certificate used to authenticate with the VM through ssh. The + * key needs to be at least 2048-bit and in ssh-rsa format. For creating ssh keys, + * see [Create SSH keys on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + * + * @param keyData the keyData value to set. + * @return the SshPublicKey object itself. + */ + public SshPublicKey withKeyData(String keyData) { + this.keyData = keyData; + 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("path", this.path); + jsonWriter.writeStringField("keyData", this.keyData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SshPublicKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SshPublicKey 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 SshPublicKey. + */ + public static SshPublicKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SshPublicKey deserializedSshPublicKey = new SshPublicKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedSshPublicKey.path = reader.getString(); + } else if ("keyData".equals(fieldName)) { + deserializedSshPublicKey.keyData = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSshPublicKey; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/StorageAccountTypes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/StorageAccountTypes.java new file mode 100644 index 0000000000000..4a9fa4de6e29d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/StorageAccountTypes.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the storage account type for the managed disk. Managed OS disk + * storage account type can only be set when you create the scale set. NOTE: + * UltraSSD_LRS can only be used with data disks. It cannot be used with OS Disk. + * Standard_LRS uses Standard HDD. StandardSSD_LRS uses Standard SSD. Premium_LRS + * uses Premium SSD. UltraSSD_LRS uses Ultra disk. Premium_ZRS uses Premium SSD + * zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant + * storage. For more information regarding disks supported for Windows Virtual + * Machines, refer to + * https://learn.microsoft.com/azure/virtual-machines/windows/disks-types and, for + * Linux Virtual Machines, refer to + * https://learn.microsoft.com/azure/virtual-machines/linux/disks-types. + */ +public final class StorageAccountTypes extends ExpandableStringEnum { + /** + * Static value Standard_LRS for StorageAccountTypes. + */ + public static final StorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); + + /** + * Static value Premium_LRS for StorageAccountTypes. + */ + public static final StorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); + + /** + * Static value StandardSSD_LRS for StorageAccountTypes. + */ + public static final StorageAccountTypes STANDARD_SSD_LRS = fromString("StandardSSD_LRS"); + + /** + * Static value UltraSSD_LRS for StorageAccountTypes. + */ + public static final StorageAccountTypes ULTRA_SSD_LRS = fromString("UltraSSD_LRS"); + + /** + * Static value Premium_ZRS for StorageAccountTypes. + */ + public static final StorageAccountTypes PREMIUM_ZRS = fromString("Premium_ZRS"); + + /** + * Static value StandardSSD_ZRS for StorageAccountTypes. + */ + public static final StorageAccountTypes STANDARD_SSD_ZRS = fromString("StandardSSD_ZRS"); + + /** + * Static value PremiumV2_LRS for StorageAccountTypes. + */ + public static final StorageAccountTypes PREMIUM_V2_LRS = fromString("PremiumV2_LRS"); + + /** + * Creates a new instance of StorageAccountTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageAccountTypes() { + } + + /** + * Creates or finds a StorageAccountTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAccountTypes. + */ + public static StorageAccountTypes fromString(String name) { + return fromString(name, StorageAccountTypes.class); + } + + /** + * Gets known StorageAccountTypes values. + * + * @return known StorageAccountTypes values. + */ + public static Collection values() { + return values(StorageAccountTypes.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/TerminateNotificationProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/TerminateNotificationProfile.java new file mode 100644 index 0000000000000..2deab4d5eb95d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/TerminateNotificationProfile.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies Terminate Scheduled Event related configurations. + */ +@Fluent +public final class TerminateNotificationProfile implements JsonSerializable { + /* + * Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is auto + * approved (timed out). The configuration must be specified in ISO 8601 format, + * the default value is 5 minutes (PT5M) + */ + private String notBeforeTimeout; + + /* + * Specifies whether the Terminate Scheduled event is enabled or disabled. + */ + private Boolean enable; + + /** + * Creates an instance of TerminateNotificationProfile class. + */ + public TerminateNotificationProfile() { + } + + /** + * Get the notBeforeTimeout property: Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is auto + * approved (timed out). The configuration must be specified in ISO 8601 format, + * the default value is 5 minutes (PT5M). + * + * @return the notBeforeTimeout value. + */ + public String notBeforeTimeout() { + return this.notBeforeTimeout; + } + + /** + * Set the notBeforeTimeout property: Configurable length of time a Virtual Machine being deleted will have to + * potentially approve the Terminate Scheduled Event before the event is auto + * approved (timed out). The configuration must be specified in ISO 8601 format, + * the default value is 5 minutes (PT5M). + * + * @param notBeforeTimeout the notBeforeTimeout value to set. + * @return the TerminateNotificationProfile object itself. + */ + public TerminateNotificationProfile withNotBeforeTimeout(String notBeforeTimeout) { + this.notBeforeTimeout = notBeforeTimeout; + return this; + } + + /** + * Get the enable property: Specifies whether the Terminate Scheduled event is enabled or disabled. + * + * @return the enable value. + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set the enable property: Specifies whether the Terminate Scheduled event is enabled or disabled. + * + * @param enable the enable value to set. + * @return the TerminateNotificationProfile object itself. + */ + public TerminateNotificationProfile withEnable(Boolean enable) { + this.enable = enable; + 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("notBeforeTimeout", this.notBeforeTimeout); + jsonWriter.writeBooleanField("enable", this.enable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TerminateNotificationProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TerminateNotificationProfile 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 TerminateNotificationProfile. + */ + public static TerminateNotificationProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TerminateNotificationProfile deserializedTerminateNotificationProfile = new TerminateNotificationProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("notBeforeTimeout".equals(fieldName)) { + deserializedTerminateNotificationProfile.notBeforeTimeout = reader.getString(); + } else if ("enable".equals(fieldName)) { + deserializedTerminateNotificationProfile.enable = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedTerminateNotificationProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UefiSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UefiSettings.java new file mode 100644 index 0000000000000..ca1583174362e --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UefiSettings.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the security settings like secure boot and vTPM used while creating + * the virtual machine. Minimum api-version: 2020-12-01. + */ +@Fluent +public final class UefiSettings implements JsonSerializable { + /* + * Specifies whether secure boot should be enabled on the virtual machine. Minimum + * api-version: 2020-12-01. + */ + private Boolean secureBootEnabled; + + /* + * Specifies whether vTPM should be enabled on the virtual machine. Minimum + * api-version: 2020-12-01. + */ + private Boolean vTpmEnabled; + + /** + * Creates an instance of UefiSettings class. + */ + public UefiSettings() { + } + + /** + * Get the secureBootEnabled property: Specifies whether secure boot should be enabled on the virtual machine. + * Minimum + * api-version: 2020-12-01. + * + * @return the secureBootEnabled value. + */ + public Boolean secureBootEnabled() { + return this.secureBootEnabled; + } + + /** + * Set the secureBootEnabled property: Specifies whether secure boot should be enabled on the virtual machine. + * Minimum + * api-version: 2020-12-01. + * + * @param secureBootEnabled the secureBootEnabled value to set. + * @return the UefiSettings object itself. + */ + public UefiSettings withSecureBootEnabled(Boolean secureBootEnabled) { + this.secureBootEnabled = secureBootEnabled; + return this; + } + + /** + * Get the vTpmEnabled property: Specifies whether vTPM should be enabled on the virtual machine. Minimum + * api-version: 2020-12-01. + * + * @return the vTpmEnabled value. + */ + public Boolean vTpmEnabled() { + return this.vTpmEnabled; + } + + /** + * Set the vTpmEnabled property: Specifies whether vTPM should be enabled on the virtual machine. Minimum + * api-version: 2020-12-01. + * + * @param vTpmEnabled the vTpmEnabled value to set. + * @return the UefiSettings object itself. + */ + public UefiSettings withVTpmEnabled(Boolean vTpmEnabled) { + this.vTpmEnabled = vTpmEnabled; + 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.writeBooleanField("secureBootEnabled", this.secureBootEnabled); + jsonWriter.writeBooleanField("vTpmEnabled", this.vTpmEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UefiSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UefiSettings 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 UefiSettings. + */ + public static UefiSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UefiSettings deserializedUefiSettings = new UefiSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("secureBootEnabled".equals(fieldName)) { + deserializedUefiSettings.secureBootEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("vTpmEnabled".equals(fieldName)) { + deserializedUefiSettings.vTpmEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedUefiSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentities.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentities.java new file mode 100644 index 0000000000000..51a44a984ee69 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentities.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * The UserAssignedIdentities model. + */ +@Immutable +public final class UserAssignedIdentities extends UserAssignedIdentity { + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /** + * Creates an instance of UserAssignedIdentities class. + */ + public UserAssignedIdentities() { + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + @Override + public UUID clientId() { + return this.clientId; + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + @Override + public UUID principalId() { + return this.principalId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentities 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 UserAssignedIdentities. + */ + public static UserAssignedIdentities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentities deserializedUserAssignedIdentities = new UserAssignedIdentities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentities.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentities.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentities; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentity.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..e1fe678c90b24 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/UserAssignedIdentity.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The principal ID of the assigned identity. + * + * @param principalId the principalId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withPrincipalId(UUID principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The client ID of the assigned identity. + * + * @param clientId the clientId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withClientId(UUID 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(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxDouble.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxDouble.java new file mode 100644 index 0000000000000..2b61299f74984 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxDouble.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * VMAttributes using double values. + */ +@Fluent +public final class VMAttributeMinMaxDouble implements JsonSerializable { + /* + * Minimum value. default 0. Double.MinValue() + */ + private Double min; + + /* + * Maximum value. Double.MaxValue(1.7976931348623157E+308) + */ + private Double max; + + /** + * Creates an instance of VMAttributeMinMaxDouble class. + */ + public VMAttributeMinMaxDouble() { + } + + /** + * Get the min property: Minimum value. default 0. Double.MinValue(). + * + * @return the min value. + */ + public Double min() { + return this.min; + } + + /** + * Set the min property: Minimum value. default 0. Double.MinValue(). + * + * @param min the min value to set. + * @return the VMAttributeMinMaxDouble object itself. + */ + public VMAttributeMinMaxDouble withMin(Double min) { + this.min = min; + return this; + } + + /** + * Get the max property: Maximum value. Double.MaxValue(1.7976931348623157E+308). + * + * @return the max value. + */ + public Double max() { + return this.max; + } + + /** + * Set the max property: Maximum value. Double.MaxValue(1.7976931348623157E+308). + * + * @param max the max value to set. + * @return the VMAttributeMinMaxDouble object itself. + */ + public VMAttributeMinMaxDouble withMax(Double max) { + this.max = max; + 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.writeNumberField("min", this.min); + jsonWriter.writeNumberField("max", this.max); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMAttributeMinMaxDouble from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMAttributeMinMaxDouble 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 VMAttributeMinMaxDouble. + */ + public static VMAttributeMinMaxDouble fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMAttributeMinMaxDouble deserializedVMAttributeMinMaxDouble = new VMAttributeMinMaxDouble(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("min".equals(fieldName)) { + deserializedVMAttributeMinMaxDouble.min = reader.getNullable(JsonReader::getDouble); + } else if ("max".equals(fieldName)) { + deserializedVMAttributeMinMaxDouble.max = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedVMAttributeMinMaxDouble; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxInteger.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxInteger.java new file mode 100644 index 0000000000000..bd570f35f6004 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeMinMaxInteger.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * While retrieving VMSizes from CRS, Min = 0 (uint.MinValue) if not specified, Max = 4294967295 (uint.MaxValue) if not + * specified. This allows to filter VMAttributes on all available VMSizes. + */ +@Fluent +public final class VMAttributeMinMaxInteger implements JsonSerializable { + /* + * Min VMSize from CRS, Min = 0 (uint.MinValue) if not specified. + */ + private Integer min; + + /* + * Max VMSize from CRS, Max = 4294967295 (uint.MaxValue) if not specified. + */ + private Integer max; + + /** + * Creates an instance of VMAttributeMinMaxInteger class. + */ + public VMAttributeMinMaxInteger() { + } + + /** + * Get the min property: Min VMSize from CRS, Min = 0 (uint.MinValue) if not specified. + * + * @return the min value. + */ + public Integer min() { + return this.min; + } + + /** + * Set the min property: Min VMSize from CRS, Min = 0 (uint.MinValue) if not specified. + * + * @param min the min value to set. + * @return the VMAttributeMinMaxInteger object itself. + */ + public VMAttributeMinMaxInteger withMin(Integer min) { + this.min = min; + return this; + } + + /** + * Get the max property: Max VMSize from CRS, Max = 4294967295 (uint.MaxValue) if not specified. + * + * @return the max value. + */ + public Integer max() { + return this.max; + } + + /** + * Set the max property: Max VMSize from CRS, Max = 4294967295 (uint.MaxValue) if not specified. + * + * @param max the max value to set. + * @return the VMAttributeMinMaxInteger object itself. + */ + public VMAttributeMinMaxInteger withMax(Integer max) { + this.max = max; + 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.writeNumberField("min", this.min); + jsonWriter.writeNumberField("max", this.max); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMAttributeMinMaxInteger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMAttributeMinMaxInteger 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 VMAttributeMinMaxInteger. + */ + public static VMAttributeMinMaxInteger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMAttributeMinMaxInteger deserializedVMAttributeMinMaxInteger = new VMAttributeMinMaxInteger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("min".equals(fieldName)) { + deserializedVMAttributeMinMaxInteger.min = reader.getNullable(JsonReader::getInt); + } else if ("max".equals(fieldName)) { + deserializedVMAttributeMinMaxInteger.max = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVMAttributeMinMaxInteger; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeSupport.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeSupport.java new file mode 100644 index 0000000000000..9332eb1bccab4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributeSupport.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * VMSizes supported by Azure VMs. Included is a union of Excluded and Required. + */ +public final class VMAttributeSupport extends ExpandableStringEnum { + /** + * Static value Excluded for VMAttributeSupport. + */ + public static final VMAttributeSupport EXCLUDED = fromString("Excluded"); + + /** + * Static value Included for VMAttributeSupport. + */ + public static final VMAttributeSupport INCLUDED = fromString("Included"); + + /** + * Static value Required for VMAttributeSupport. + */ + public static final VMAttributeSupport REQUIRED = fromString("Required"); + + /** + * Creates a new instance of VMAttributeSupport value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VMAttributeSupport() { + } + + /** + * Creates or finds a VMAttributeSupport from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMAttributeSupport. + */ + public static VMAttributeSupport fromString(String name) { + return fromString(name, VMAttributeSupport.class); + } + + /** + * Gets known VMAttributeSupport values. + * + * @return known VMAttributeSupport values. + */ + public static Collection values() { + return values(VMAttributeSupport.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributes.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributes.java new file mode 100644 index 0000000000000..d7cd01061241f --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMAttributes.java @@ -0,0 +1,764 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; +import java.util.List; + +/** + * VMAttributes that will be used to filter VMSizes which will be used to build Fleet. + */ +@Fluent +public final class VMAttributes implements JsonSerializable { + /* + * The range of vCpuCount specified from Min to Max. Must be specified if VMAttributes are specified, either Min or + * Max is required if specified. + */ + private VMAttributeMinMaxInteger vCpuCount; + + /* + * The range of memory specified from Min to Max. Must be specified if VMAttributes are specified, either Min or Max + * is required if specified. + */ + private VMAttributeMinMaxDouble memoryInGiB; + + /* + * The range of memory in GiB per vCPU specified from min to max. Optional parameter. Either Min or Max is required + * if specified. + */ + private VMAttributeMinMaxDouble memoryInGiBPerVCpu; + + /* + * Specifies whether the VMSize supporting local storage should be used to build Fleet or not. + * Included - Default if not specified as most Azure VMs support local storage. + */ + private VMAttributeSupport localStorageSupport; + + /* + * LocalStorageSupport should be set to "Included" or "Required" to use this VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + */ + private VMAttributeMinMaxDouble localStorageInGiB; + + /* + * The local storage disk types specified as a list. LocalStorageSupport should be set to "Included" or "Required" + * to use this VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + */ + private List localStorageDiskTypes; + + /* + * The range of data disk count specified from Min to Max. Optional parameter. Either Min or Max is required if + * specified. + */ + private VMAttributeMinMaxInteger dataDiskCount; + + /* + * The range of network interface count specified from Min to Max. Optional parameter. Either Min or Max is required + * if specified. + */ + private VMAttributeMinMaxInteger networkInterfaceCount; + + /* + * The range of network bandwidth in Mbps specified from Min to Max. Optional parameter. Either Min or Max is + * required if specified. + */ + private VMAttributeMinMaxDouble networkBandwidthInMbps; + + /* + * Specifies whether the VMSize supporting RDMA (Remote Direct Memory Access) should be used to build Fleet or not. + */ + private VMAttributeSupport rdmaSupport; + + /* + * The range of RDMA (Remote Direct Memory Access) network interface count specified from Min to Max. Optional + * parameter. Either Min or Max is required if specified. + * rdmaSupport should be set to "Included" or "Required" to use this VMAttribute. + * If rdmaSupport is "Excluded", this VMAttribute can not be used. + */ + private VMAttributeMinMaxInteger rdmaNetworkInterfaceCount; + + /* + * Specifies whether the VMSize supporting accelerator should be used to build Fleet or not. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + */ + private VMAttributeSupport acceleratorSupport; + + /* + * The accelerator manufacturers specified as a list. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + */ + private List acceleratorManufacturers; + + /* + * The accelerator types specified as a list. acceleratorSupport should be set to "Included" or "Required" to use + * this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + */ + private List acceleratorTypes; + + /* + * The range of accelerator count specified from min to max. Optional parameter. Either Min or Max is required if + * specified. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + */ + private VMAttributeMinMaxInteger acceleratorCount; + + /* + * The VM category specified as a list. Optional parameter. + */ + private List vmCategories; + + /* + * The VM architecture types specified as a list. Optional parameter. + */ + private List architectureTypes; + + /* + * The VM CPU manufacturers specified as a list. Optional parameter. + */ + private List cpuManufacturers; + + /* + * Specifies whether the VMSize supporting burstable capability should be used to build Fleet or not. + */ + private VMAttributeSupport burstableSupport; + + /* + * Specifies which VMSizes should be excluded while building Fleet. Optional parameter. + */ + private List excludedVMSizes; + + /** + * Creates an instance of VMAttributes class. + */ + public VMAttributes() { + } + + /** + * Get the vCpuCount property: The range of vCpuCount specified from Min to Max. Must be specified if VMAttributes + * are specified, either Min or Max is required if specified. + * + * @return the vCpuCount value. + */ + public VMAttributeMinMaxInteger vCpuCount() { + return this.vCpuCount; + } + + /** + * Set the vCpuCount property: The range of vCpuCount specified from Min to Max. Must be specified if VMAttributes + * are specified, either Min or Max is required if specified. + * + * @param vCpuCount the vCpuCount value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withVCpuCount(VMAttributeMinMaxInteger vCpuCount) { + this.vCpuCount = vCpuCount; + return this; + } + + /** + * Get the memoryInGiB property: The range of memory specified from Min to Max. Must be specified if VMAttributes + * are specified, either Min or Max is required if specified. + * + * @return the memoryInGiB value. + */ + public VMAttributeMinMaxDouble memoryInGiB() { + return this.memoryInGiB; + } + + /** + * Set the memoryInGiB property: The range of memory specified from Min to Max. Must be specified if VMAttributes + * are specified, either Min or Max is required if specified. + * + * @param memoryInGiB the memoryInGiB value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withMemoryInGiB(VMAttributeMinMaxDouble memoryInGiB) { + this.memoryInGiB = memoryInGiB; + return this; + } + + /** + * Get the memoryInGiBPerVCpu property: The range of memory in GiB per vCPU specified from min to max. Optional + * parameter. Either Min or Max is required if specified. + * + * @return the memoryInGiBPerVCpu value. + */ + public VMAttributeMinMaxDouble memoryInGiBPerVCpu() { + return this.memoryInGiBPerVCpu; + } + + /** + * Set the memoryInGiBPerVCpu property: The range of memory in GiB per vCPU specified from min to max. Optional + * parameter. Either Min or Max is required if specified. + * + * @param memoryInGiBPerVCpu the memoryInGiBPerVCpu value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withMemoryInGiBPerVCpu(VMAttributeMinMaxDouble memoryInGiBPerVCpu) { + this.memoryInGiBPerVCpu = memoryInGiBPerVCpu; + return this; + } + + /** + * Get the localStorageSupport property: Specifies whether the VMSize supporting local storage should be used to + * build Fleet or not. + * Included - Default if not specified as most Azure VMs support local storage. + * + * @return the localStorageSupport value. + */ + public VMAttributeSupport localStorageSupport() { + return this.localStorageSupport; + } + + /** + * Set the localStorageSupport property: Specifies whether the VMSize supporting local storage should be used to + * build Fleet or not. + * Included - Default if not specified as most Azure VMs support local storage. + * + * @param localStorageSupport the localStorageSupport value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withLocalStorageSupport(VMAttributeSupport localStorageSupport) { + this.localStorageSupport = localStorageSupport; + return this; + } + + /** + * Get the localStorageInGiB property: LocalStorageSupport should be set to "Included" or "Required" to use this + * VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + * + * @return the localStorageInGiB value. + */ + public VMAttributeMinMaxDouble localStorageInGiB() { + return this.localStorageInGiB; + } + + /** + * Set the localStorageInGiB property: LocalStorageSupport should be set to "Included" or "Required" to use this + * VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + * + * @param localStorageInGiB the localStorageInGiB value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withLocalStorageInGiB(VMAttributeMinMaxDouble localStorageInGiB) { + this.localStorageInGiB = localStorageInGiB; + return this; + } + + /** + * Get the localStorageDiskTypes property: The local storage disk types specified as a list. LocalStorageSupport + * should be set to "Included" or "Required" to use this VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + * + * @return the localStorageDiskTypes value. + */ + public List localStorageDiskTypes() { + return this.localStorageDiskTypes; + } + + /** + * Set the localStorageDiskTypes property: The local storage disk types specified as a list. LocalStorageSupport + * should be set to "Included" or "Required" to use this VMAttribute. + * If localStorageSupport is "Excluded", this VMAttribute can not be used. + * + * @param localStorageDiskTypes the localStorageDiskTypes value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withLocalStorageDiskTypes(List localStorageDiskTypes) { + this.localStorageDiskTypes = localStorageDiskTypes; + return this; + } + + /** + * Get the dataDiskCount property: The range of data disk count specified from Min to Max. Optional parameter. + * Either Min or Max is required if specified. + * + * @return the dataDiskCount value. + */ + public VMAttributeMinMaxInteger dataDiskCount() { + return this.dataDiskCount; + } + + /** + * Set the dataDiskCount property: The range of data disk count specified from Min to Max. Optional parameter. + * Either Min or Max is required if specified. + * + * @param dataDiskCount the dataDiskCount value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withDataDiskCount(VMAttributeMinMaxInteger dataDiskCount) { + this.dataDiskCount = dataDiskCount; + return this; + } + + /** + * Get the networkInterfaceCount property: The range of network interface count specified from Min to Max. Optional + * parameter. Either Min or Max is required if specified. + * + * @return the networkInterfaceCount value. + */ + public VMAttributeMinMaxInteger networkInterfaceCount() { + return this.networkInterfaceCount; + } + + /** + * Set the networkInterfaceCount property: The range of network interface count specified from Min to Max. Optional + * parameter. Either Min or Max is required if specified. + * + * @param networkInterfaceCount the networkInterfaceCount value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withNetworkInterfaceCount(VMAttributeMinMaxInteger networkInterfaceCount) { + this.networkInterfaceCount = networkInterfaceCount; + return this; + } + + /** + * Get the networkBandwidthInMbps property: The range of network bandwidth in Mbps specified from Min to Max. + * Optional parameter. Either Min or Max is required if specified. + * + * @return the networkBandwidthInMbps value. + */ + public VMAttributeMinMaxDouble networkBandwidthInMbps() { + return this.networkBandwidthInMbps; + } + + /** + * Set the networkBandwidthInMbps property: The range of network bandwidth in Mbps specified from Min to Max. + * Optional parameter. Either Min or Max is required if specified. + * + * @param networkBandwidthInMbps the networkBandwidthInMbps value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withNetworkBandwidthInMbps(VMAttributeMinMaxDouble networkBandwidthInMbps) { + this.networkBandwidthInMbps = networkBandwidthInMbps; + return this; + } + + /** + * Get the rdmaSupport property: Specifies whether the VMSize supporting RDMA (Remote Direct Memory Access) should + * be used to build Fleet or not. + * + * @return the rdmaSupport value. + */ + public VMAttributeSupport rdmaSupport() { + return this.rdmaSupport; + } + + /** + * Set the rdmaSupport property: Specifies whether the VMSize supporting RDMA (Remote Direct Memory Access) should + * be used to build Fleet or not. + * + * @param rdmaSupport the rdmaSupport value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withRdmaSupport(VMAttributeSupport rdmaSupport) { + this.rdmaSupport = rdmaSupport; + return this; + } + + /** + * Get the rdmaNetworkInterfaceCount property: The range of RDMA (Remote Direct Memory Access) network interface + * count specified from Min to Max. Optional parameter. Either Min or Max is required if specified. + * rdmaSupport should be set to "Included" or "Required" to use this VMAttribute. + * If rdmaSupport is "Excluded", this VMAttribute can not be used. + * + * @return the rdmaNetworkInterfaceCount value. + */ + public VMAttributeMinMaxInteger rdmaNetworkInterfaceCount() { + return this.rdmaNetworkInterfaceCount; + } + + /** + * Set the rdmaNetworkInterfaceCount property: The range of RDMA (Remote Direct Memory Access) network interface + * count specified from Min to Max. Optional parameter. Either Min or Max is required if specified. + * rdmaSupport should be set to "Included" or "Required" to use this VMAttribute. + * If rdmaSupport is "Excluded", this VMAttribute can not be used. + * + * @param rdmaNetworkInterfaceCount the rdmaNetworkInterfaceCount value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withRdmaNetworkInterfaceCount(VMAttributeMinMaxInteger rdmaNetworkInterfaceCount) { + this.rdmaNetworkInterfaceCount = rdmaNetworkInterfaceCount; + return this; + } + + /** + * Get the acceleratorSupport property: Specifies whether the VMSize supporting accelerator should be used to build + * Fleet or not. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @return the acceleratorSupport value. + */ + public VMAttributeSupport acceleratorSupport() { + return this.acceleratorSupport; + } + + /** + * Set the acceleratorSupport property: Specifies whether the VMSize supporting accelerator should be used to build + * Fleet or not. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @param acceleratorSupport the acceleratorSupport value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withAcceleratorSupport(VMAttributeSupport acceleratorSupport) { + this.acceleratorSupport = acceleratorSupport; + return this; + } + + /** + * Get the acceleratorManufacturers property: The accelerator manufacturers specified as a list. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @return the acceleratorManufacturers value. + */ + public List acceleratorManufacturers() { + return this.acceleratorManufacturers; + } + + /** + * Set the acceleratorManufacturers property: The accelerator manufacturers specified as a list. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @param acceleratorManufacturers the acceleratorManufacturers value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withAcceleratorManufacturers(List acceleratorManufacturers) { + this.acceleratorManufacturers = acceleratorManufacturers; + return this; + } + + /** + * Get the acceleratorTypes property: The accelerator types specified as a list. acceleratorSupport should be set to + * "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @return the acceleratorTypes value. + */ + public List acceleratorTypes() { + return this.acceleratorTypes; + } + + /** + * Set the acceleratorTypes property: The accelerator types specified as a list. acceleratorSupport should be set to + * "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @param acceleratorTypes the acceleratorTypes value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withAcceleratorTypes(List acceleratorTypes) { + this.acceleratorTypes = acceleratorTypes; + return this; + } + + /** + * Get the acceleratorCount property: The range of accelerator count specified from min to max. Optional parameter. + * Either Min or Max is required if specified. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @return the acceleratorCount value. + */ + public VMAttributeMinMaxInteger acceleratorCount() { + return this.acceleratorCount; + } + + /** + * Set the acceleratorCount property: The range of accelerator count specified from min to max. Optional parameter. + * Either Min or Max is required if specified. + * acceleratorSupport should be set to "Included" or "Required" to use this VMAttribute. + * If acceleratorSupport is "Excluded", this VMAttribute can not be used. + * + * @param acceleratorCount the acceleratorCount value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withAcceleratorCount(VMAttributeMinMaxInteger acceleratorCount) { + this.acceleratorCount = acceleratorCount; + return this; + } + + /** + * Get the vmCategories property: The VM category specified as a list. Optional parameter. + * + * @return the vmCategories value. + */ + public List vmCategories() { + return this.vmCategories; + } + + /** + * Set the vmCategories property: The VM category specified as a list. Optional parameter. + * + * @param vmCategories the vmCategories value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withVmCategories(List vmCategories) { + this.vmCategories = vmCategories; + return this; + } + + /** + * Get the architectureTypes property: The VM architecture types specified as a list. Optional parameter. + * + * @return the architectureTypes value. + */ + public List architectureTypes() { + return this.architectureTypes; + } + + /** + * Set the architectureTypes property: The VM architecture types specified as a list. Optional parameter. + * + * @param architectureTypes the architectureTypes value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withArchitectureTypes(List architectureTypes) { + this.architectureTypes = architectureTypes; + return this; + } + + /** + * Get the cpuManufacturers property: The VM CPU manufacturers specified as a list. Optional parameter. + * + * @return the cpuManufacturers value. + */ + public List cpuManufacturers() { + return this.cpuManufacturers; + } + + /** + * Set the cpuManufacturers property: The VM CPU manufacturers specified as a list. Optional parameter. + * + * @param cpuManufacturers the cpuManufacturers value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withCpuManufacturers(List cpuManufacturers) { + this.cpuManufacturers = cpuManufacturers; + return this; + } + + /** + * Get the burstableSupport property: Specifies whether the VMSize supporting burstable capability should be used to + * build Fleet or not. + * + * @return the burstableSupport value. + */ + public VMAttributeSupport burstableSupport() { + return this.burstableSupport; + } + + /** + * Set the burstableSupport property: Specifies whether the VMSize supporting burstable capability should be used to + * build Fleet or not. + * + * @param burstableSupport the burstableSupport value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withBurstableSupport(VMAttributeSupport burstableSupport) { + this.burstableSupport = burstableSupport; + return this; + } + + /** + * Get the excludedVMSizes property: Specifies which VMSizes should be excluded while building Fleet. Optional + * parameter. + * + * @return the excludedVMSizes value. + */ + public List excludedVMSizes() { + return this.excludedVMSizes; + } + + /** + * Set the excludedVMSizes property: Specifies which VMSizes should be excluded while building Fleet. Optional + * parameter. + * + * @param excludedVMSizes the excludedVMSizes value to set. + * @return the VMAttributes object itself. + */ + public VMAttributes withExcludedVMSizes(List excludedVMSizes) { + this.excludedVMSizes = excludedVMSizes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vCpuCount() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property vCpuCount in model VMAttributes")); + } else { + vCpuCount().validate(); + } + if (memoryInGiB() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property memoryInGiB in model VMAttributes")); + } else { + memoryInGiB().validate(); + } + if (memoryInGiBPerVCpu() != null) { + memoryInGiBPerVCpu().validate(); + } + if (localStorageInGiB() != null) { + localStorageInGiB().validate(); + } + if (dataDiskCount() != null) { + dataDiskCount().validate(); + } + if (networkInterfaceCount() != null) { + networkInterfaceCount().validate(); + } + if (networkBandwidthInMbps() != null) { + networkBandwidthInMbps().validate(); + } + if (rdmaNetworkInterfaceCount() != null) { + rdmaNetworkInterfaceCount().validate(); + } + if (acceleratorCount() != null) { + acceleratorCount().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VMAttributes.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("vCpuCount", this.vCpuCount); + jsonWriter.writeJsonField("memoryInGiB", this.memoryInGiB); + jsonWriter.writeJsonField("memoryInGiBPerVCpu", this.memoryInGiBPerVCpu); + jsonWriter.writeStringField("localStorageSupport", + this.localStorageSupport == null ? null : this.localStorageSupport.toString()); + jsonWriter.writeJsonField("localStorageInGiB", this.localStorageInGiB); + jsonWriter.writeArrayField("localStorageDiskTypes", this.localStorageDiskTypes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("dataDiskCount", this.dataDiskCount); + jsonWriter.writeJsonField("networkInterfaceCount", this.networkInterfaceCount); + jsonWriter.writeJsonField("networkBandwidthInMbps", this.networkBandwidthInMbps); + jsonWriter.writeStringField("rdmaSupport", this.rdmaSupport == null ? null : this.rdmaSupport.toString()); + jsonWriter.writeJsonField("rdmaNetworkInterfaceCount", this.rdmaNetworkInterfaceCount); + jsonWriter.writeStringField("acceleratorSupport", + this.acceleratorSupport == null ? null : this.acceleratorSupport.toString()); + jsonWriter.writeArrayField("acceleratorManufacturers", this.acceleratorManufacturers, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("acceleratorTypes", this.acceleratorTypes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("acceleratorCount", this.acceleratorCount); + jsonWriter.writeArrayField("vmCategories", this.vmCategories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("architectureTypes", this.architectureTypes, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("cpuManufacturers", this.cpuManufacturers, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("burstableSupport", + this.burstableSupport == null ? null : this.burstableSupport.toString()); + jsonWriter.writeArrayField("excludedVMSizes", this.excludedVMSizes, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMAttributes from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMAttributes 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 VMAttributes. + */ + public static VMAttributes fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMAttributes deserializedVMAttributes = new VMAttributes(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vCpuCount".equals(fieldName)) { + deserializedVMAttributes.vCpuCount = VMAttributeMinMaxInteger.fromJson(reader); + } else if ("memoryInGiB".equals(fieldName)) { + deserializedVMAttributes.memoryInGiB = VMAttributeMinMaxDouble.fromJson(reader); + } else if ("memoryInGiBPerVCpu".equals(fieldName)) { + deserializedVMAttributes.memoryInGiBPerVCpu = VMAttributeMinMaxDouble.fromJson(reader); + } else if ("localStorageSupport".equals(fieldName)) { + deserializedVMAttributes.localStorageSupport = VMAttributeSupport.fromString(reader.getString()); + } else if ("localStorageInGiB".equals(fieldName)) { + deserializedVMAttributes.localStorageInGiB = VMAttributeMinMaxDouble.fromJson(reader); + } else if ("localStorageDiskTypes".equals(fieldName)) { + List localStorageDiskTypes + = reader.readArray(reader1 -> LocalStorageDiskType.fromString(reader1.getString())); + deserializedVMAttributes.localStorageDiskTypes = localStorageDiskTypes; + } else if ("dataDiskCount".equals(fieldName)) { + deserializedVMAttributes.dataDiskCount = VMAttributeMinMaxInteger.fromJson(reader); + } else if ("networkInterfaceCount".equals(fieldName)) { + deserializedVMAttributes.networkInterfaceCount = VMAttributeMinMaxInteger.fromJson(reader); + } else if ("networkBandwidthInMbps".equals(fieldName)) { + deserializedVMAttributes.networkBandwidthInMbps = VMAttributeMinMaxDouble.fromJson(reader); + } else if ("rdmaSupport".equals(fieldName)) { + deserializedVMAttributes.rdmaSupport = VMAttributeSupport.fromString(reader.getString()); + } else if ("rdmaNetworkInterfaceCount".equals(fieldName)) { + deserializedVMAttributes.rdmaNetworkInterfaceCount = VMAttributeMinMaxInteger.fromJson(reader); + } else if ("acceleratorSupport".equals(fieldName)) { + deserializedVMAttributes.acceleratorSupport = VMAttributeSupport.fromString(reader.getString()); + } else if ("acceleratorManufacturers".equals(fieldName)) { + List acceleratorManufacturers + = reader.readArray(reader1 -> AcceleratorManufacturer.fromString(reader1.getString())); + deserializedVMAttributes.acceleratorManufacturers = acceleratorManufacturers; + } else if ("acceleratorTypes".equals(fieldName)) { + List acceleratorTypes + = reader.readArray(reader1 -> AcceleratorType.fromString(reader1.getString())); + deserializedVMAttributes.acceleratorTypes = acceleratorTypes; + } else if ("acceleratorCount".equals(fieldName)) { + deserializedVMAttributes.acceleratorCount = VMAttributeMinMaxInteger.fromJson(reader); + } else if ("vmCategories".equals(fieldName)) { + List vmCategories + = reader.readArray(reader1 -> VMCategory.fromString(reader1.getString())); + deserializedVMAttributes.vmCategories = vmCategories; + } else if ("architectureTypes".equals(fieldName)) { + List architectureTypes + = reader.readArray(reader1 -> ArchitectureType.fromString(reader1.getString())); + deserializedVMAttributes.architectureTypes = architectureTypes; + } else if ("cpuManufacturers".equals(fieldName)) { + List cpuManufacturers + = reader.readArray(reader1 -> CpuManufacturer.fromString(reader1.getString())); + deserializedVMAttributes.cpuManufacturers = cpuManufacturers; + } else if ("burstableSupport".equals(fieldName)) { + deserializedVMAttributes.burstableSupport = VMAttributeSupport.fromString(reader.getString()); + } else if ("excludedVMSizes".equals(fieldName)) { + List excludedVMSizes = reader.readArray(reader1 -> reader1.getString()); + deserializedVMAttributes.excludedVMSizes = excludedVMSizes; + } else { + reader.skipChildren(); + } + } + + return deserializedVMAttributes; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMCategory.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMCategory.java new file mode 100644 index 0000000000000..fb7fc246d4ccf --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMCategory.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * VMCategories defined for Azure VMs. + * See: + * https://learn.microsoft.com/en-us/azure/virtual-machines/sizes/overview?tabs=breakdownseries%2Cgeneralsizelist%2Ccomputesizelist%2Cmemorysizelist%2Cstoragesizelist%2Cgpusizelist%2Cfpgasizelist%2Chpcsizelist#general-purpose. + */ +public final class VMCategory extends ExpandableStringEnum { + /** + * Static value GeneralPurpose for VMCategory. + */ + public static final VMCategory GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** + * Static value ComputeOptimized for VMCategory. + */ + public static final VMCategory COMPUTE_OPTIMIZED = fromString("ComputeOptimized"); + + /** + * Static value MemoryOptimized for VMCategory. + */ + public static final VMCategory MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + + /** + * Static value StorageOptimized for VMCategory. + */ + public static final VMCategory STORAGE_OPTIMIZED = fromString("StorageOptimized"); + + /** + * Static value GpuAccelerated for VMCategory. + */ + public static final VMCategory GPU_ACCELERATED = fromString("GpuAccelerated"); + + /** + * Static value FpgaAccelerated for VMCategory. + */ + public static final VMCategory FPGA_ACCELERATED = fromString("FpgaAccelerated"); + + /** + * Static value HighPerformanceCompute for VMCategory. + */ + public static final VMCategory HIGH_PERFORMANCE_COMPUTE = fromString("HighPerformanceCompute"); + + /** + * Creates a new instance of VMCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VMCategory() { + } + + /** + * Creates or finds a VMCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding VMCategory. + */ + public static VMCategory fromString(String name) { + return fromString(name, VMCategory.class); + } + + /** + * Gets known VMCategory values. + * + * @return known VMCategory values. + */ + public static Collection values() { + return values(VMCategory.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMDiskSecurityProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMDiskSecurityProfile.java new file mode 100644 index 0000000000000..970193a27027b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMDiskSecurityProfile.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the security profile settings for the managed disk. **Note:** It can + * only be set for Confidential VMs. + */ +@Fluent +public final class VMDiskSecurityProfile implements JsonSerializable { + /* + * Specifies the EncryptionType of the managed disk. It is set to + * DiskWithVMGuestState for encryption of the managed disk along with VMGuestState + * blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and + * NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. + * **Note:** It can be set for only Confidential VMs. + */ + private SecurityEncryptionTypes securityEncryptionType; + + /* + * Specifies the customer managed disk encryption set resource id for the managed + * disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + * VMGuest blob. + */ + private DiskEncryptionSetParameters diskEncryptionSet; + + /** + * Creates an instance of VMDiskSecurityProfile class. + */ + public VMDiskSecurityProfile() { + } + + /** + * Get the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to + * DiskWithVMGuestState for encryption of the managed disk along with VMGuestState + * blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and + * NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. + * **Note:** It can be set for only Confidential VMs. + * + * @return the securityEncryptionType value. + */ + public SecurityEncryptionTypes securityEncryptionType() { + return this.securityEncryptionType; + } + + /** + * Set the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to + * DiskWithVMGuestState for encryption of the managed disk along with VMGuestState + * blob, VMGuestStateOnly for encryption of just the VMGuestState blob, and + * NonPersistedTPM for not persisting firmware state in the VMGuestState blob.. + * **Note:** It can be set for only Confidential VMs. + * + * @param securityEncryptionType the securityEncryptionType value to set. + * @return the VMDiskSecurityProfile object itself. + */ + public VMDiskSecurityProfile withSecurityEncryptionType(SecurityEncryptionTypes securityEncryptionType) { + this.securityEncryptionType = securityEncryptionType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed + * disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + * VMGuest blob. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed + * disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + * VMGuest blob. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the VMDiskSecurityProfile object itself. + */ + public VMDiskSecurityProfile withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("securityEncryptionType", + this.securityEncryptionType == null ? null : this.securityEncryptionType.toString()); + jsonWriter.writeJsonField("diskEncryptionSet", this.diskEncryptionSet); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMDiskSecurityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMDiskSecurityProfile 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 VMDiskSecurityProfile. + */ + public static VMDiskSecurityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMDiskSecurityProfile deserializedVMDiskSecurityProfile = new VMDiskSecurityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityEncryptionType".equals(fieldName)) { + deserializedVMDiskSecurityProfile.securityEncryptionType + = SecurityEncryptionTypes.fromString(reader.getString()); + } else if ("diskEncryptionSet".equals(fieldName)) { + deserializedVMDiskSecurityProfile.diskEncryptionSet = DiskEncryptionSetParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVMDiskSecurityProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMGalleryApplication.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMGalleryApplication.java new file mode 100644 index 0000000000000..173650e74a24f --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMGalleryApplication.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the required information to reference a compute gallery application + * version. + */ +@Fluent +public final class VMGalleryApplication implements JsonSerializable { + /* + * Optional, Specifies a passthrough value for more generic context. + */ + private String tags; + + /* + * Optional, Specifies the order in which the packages have to be installed + */ + private Integer order; + + /* + * Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{ + * galleryName}/applications/{application}/versions/{version} + */ + private String packageReferenceId; + + /* + * Optional, Specifies the uri to an azure blob that will replace the default + * configuration for the package if provided + */ + private String configurationReference; + + /* + * Optional, If true, any failure for any operation in the VmApplication will fail + * the deployment + */ + private Boolean treatFailureAsDeploymentFailure; + + /* + * If set to true, when a new Gallery Application version is available in PIR/SIG, + * it will be automatically updated for the VM/VMSS + */ + private Boolean enableAutomaticUpgrade; + + /** + * Creates an instance of VMGalleryApplication class. + */ + public VMGalleryApplication() { + } + + /** + * Get the tags property: Optional, Specifies a passthrough value for more generic context. + * + * @return the tags value. + */ + public String tags() { + return this.tags; + } + + /** + * Set the tags property: Optional, Specifies a passthrough value for more generic context. + * + * @param tags the tags value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withTags(String tags) { + this.tags = tags; + return this; + } + + /** + * Get the order property: Optional, Specifies the order in which the packages have to be installed. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: Optional, Specifies the order in which the packages have to be installed. + * + * @param order the order value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the packageReferenceId property: Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + * + * @return the packageReferenceId value. + */ + public String packageReferenceId() { + return this.packageReferenceId; + } + + /** + * Set the packageReferenceId property: Specifies the GalleryApplicationVersion resource id on the form of + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + * + * @param packageReferenceId the packageReferenceId value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withPackageReferenceId(String packageReferenceId) { + this.packageReferenceId = packageReferenceId; + return this; + } + + /** + * Get the configurationReference property: Optional, Specifies the uri to an azure blob that will replace the + * default + * configuration for the package if provided. + * + * @return the configurationReference value. + */ + public String configurationReference() { + return this.configurationReference; + } + + /** + * Set the configurationReference property: Optional, Specifies the uri to an azure blob that will replace the + * default + * configuration for the package if provided. + * + * @param configurationReference the configurationReference value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withConfigurationReference(String configurationReference) { + this.configurationReference = configurationReference; + return this; + } + + /** + * Get the treatFailureAsDeploymentFailure property: Optional, If true, any failure for any operation in the + * VmApplication will fail + * the deployment. + * + * @return the treatFailureAsDeploymentFailure value. + */ + public Boolean treatFailureAsDeploymentFailure() { + return this.treatFailureAsDeploymentFailure; + } + + /** + * Set the treatFailureAsDeploymentFailure property: Optional, If true, any failure for any operation in the + * VmApplication will fail + * the deployment. + * + * @param treatFailureAsDeploymentFailure the treatFailureAsDeploymentFailure value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withTreatFailureAsDeploymentFailure(Boolean treatFailureAsDeploymentFailure) { + this.treatFailureAsDeploymentFailure = treatFailureAsDeploymentFailure; + return this; + } + + /** + * Get the enableAutomaticUpgrade property: If set to true, when a new Gallery Application version is available in + * PIR/SIG, + * it will be automatically updated for the VM/VMSS. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.enableAutomaticUpgrade; + } + + /** + * Set the enableAutomaticUpgrade property: If set to true, when a new Gallery Application version is available in + * PIR/SIG, + * it will be automatically updated for the VM/VMSS. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VMGalleryApplication object itself. + */ + public VMGalleryApplication withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + this.enableAutomaticUpgrade = enableAutomaticUpgrade; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (packageReferenceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property packageReferenceId in model VMGalleryApplication")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VMGalleryApplication.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("packageReferenceId", this.packageReferenceId); + jsonWriter.writeStringField("tags", this.tags); + jsonWriter.writeNumberField("order", this.order); + jsonWriter.writeStringField("configurationReference", this.configurationReference); + jsonWriter.writeBooleanField("treatFailureAsDeploymentFailure", this.treatFailureAsDeploymentFailure); + jsonWriter.writeBooleanField("enableAutomaticUpgrade", this.enableAutomaticUpgrade); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMGalleryApplication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMGalleryApplication 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 VMGalleryApplication. + */ + public static VMGalleryApplication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMGalleryApplication deserializedVMGalleryApplication = new VMGalleryApplication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("packageReferenceId".equals(fieldName)) { + deserializedVMGalleryApplication.packageReferenceId = reader.getString(); + } else if ("tags".equals(fieldName)) { + deserializedVMGalleryApplication.tags = reader.getString(); + } else if ("order".equals(fieldName)) { + deserializedVMGalleryApplication.order = reader.getNullable(JsonReader::getInt); + } else if ("configurationReference".equals(fieldName)) { + deserializedVMGalleryApplication.configurationReference = reader.getString(); + } else if ("treatFailureAsDeploymentFailure".equals(fieldName)) { + deserializedVMGalleryApplication.treatFailureAsDeploymentFailure + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticUpgrade".equals(fieldName)) { + deserializedVMGalleryApplication.enableAutomaticUpgrade + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVMGalleryApplication; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMSizeProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMSizeProperties.java new file mode 100644 index 0000000000000..672ef0f3ed46d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VMSizeProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies VM Size Property settings on the virtual machine. + */ +@Fluent +public final class VMSizeProperties implements JsonSerializable { + /* + * Specifies the number of vCPUs available for the VM. When this property is not + * specified in the request body the default behavior is to set it to the value of + * vCPUs available for that VM size exposed in api response of [List all available + * virtual machine sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + */ + private Integer vCpusAvailable; + + /* + * Specifies the vCPU to physical core ratio. When this property is not specified + * in the request body the default behavior is set to the value of vCPUsPerCore + * for the VM Size exposed in api response of [List all available virtual machine + * sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + * **Setting this property to 1 also means that hyper-threading is disabled.** + */ + private Integer vCpusPerCore; + + /** + * Creates an instance of VMSizeProperties class. + */ + public VMSizeProperties() { + } + + /** + * Get the vCpusAvailable property: Specifies the number of vCPUs available for the VM. When this property is not + * specified in the request body the default behavior is to set it to the value of + * vCPUs available for that VM size exposed in api response of [List all available + * virtual machine sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + * + * @return the vCpusAvailable value. + */ + public Integer vCpusAvailable() { + return this.vCpusAvailable; + } + + /** + * Set the vCpusAvailable property: Specifies the number of vCPUs available for the VM. When this property is not + * specified in the request body the default behavior is to set it to the value of + * vCPUs available for that VM size exposed in api response of [List all available + * virtual machine sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + * + * @param vCpusAvailable the vCpusAvailable value to set. + * @return the VMSizeProperties object itself. + */ + public VMSizeProperties withVCpusAvailable(Integer vCpusAvailable) { + this.vCpusAvailable = vCpusAvailable; + return this; + } + + /** + * Get the vCpusPerCore property: Specifies the vCPU to physical core ratio. When this property is not specified + * in the request body the default behavior is set to the value of vCPUsPerCore + * for the VM Size exposed in api response of [List all available virtual machine + * sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + * **Setting this property to 1 also means that hyper-threading is disabled.**. + * + * @return the vCpusPerCore value. + */ + public Integer vCpusPerCore() { + return this.vCpusPerCore; + } + + /** + * Set the vCpusPerCore property: Specifies the vCPU to physical core ratio. When this property is not specified + * in the request body the default behavior is set to the value of vCPUsPerCore + * for the VM Size exposed in api response of [List all available virtual machine + * sizes in a + * region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). + * **Setting this property to 1 also means that hyper-threading is disabled.**. + * + * @param vCpusPerCore the vCpusPerCore value to set. + * @return the VMSizeProperties object itself. + */ + public VMSizeProperties withVCpusPerCore(Integer vCpusPerCore) { + this.vCpusPerCore = vCpusPerCore; + 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.writeNumberField("vCPUsAvailable", this.vCpusAvailable); + jsonWriter.writeNumberField("vCPUsPerCore", this.vCpusPerCore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMSizeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMSizeProperties 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 VMSizeProperties. + */ + public static VMSizeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMSizeProperties deserializedVMSizeProperties = new VMSizeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vCPUsAvailable".equals(fieldName)) { + deserializedVMSizeProperties.vCpusAvailable = reader.getNullable(JsonReader::getInt); + } else if ("vCPUsPerCore".equals(fieldName)) { + deserializedVMSizeProperties.vCpusPerCore = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVMSizeProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultCertificate.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultCertificate.java new file mode 100644 index 0000000000000..0d0c47c9d4384 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultCertificate.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a single certificate reference in a Key Vault, and where the + * certificate should reside on the VM. + */ +@Fluent +public final class VaultCertificate implements JsonSerializable { + /* + * This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be It is the Base64 encoding of the + * following JSON Object which is encoded in UTF-8:

{
+ * "data":"",
"dataType":"pfx",
+ * "password":""
}
To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + private String certificateUrl; + + /* + * For Windows VMs, specifies the certificate store on the Virtual Machine to + * which the certificate should be added. The specified certificate store is + * implicitly in the LocalMachine account. For Linux VMs, the certificate file is + * placed under the /var/lib/waagent directory, with the file name + * <UppercaseThumbprint>.crt for the X509 certificate file and + * <UppercaseThumbprint>.prv for private key. Both of these files are .pem + * formatted. + */ + private String certificateStore; + + /** + * Creates an instance of VaultCertificate class. + */ + public VaultCertificate() { + } + + /** + * Get the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be It is the Base64 encoding of the + * following JSON Object which is encoded in UTF-8: <br><br> {<br> + * "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> + * "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the certificateUrl value. + */ + public String certificateUrl() { + return this.certificateUrl; + } + + /** + * Set the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be It is the Base64 encoding of the + * following JSON Object which is encoded in UTF-8: <br><br> {<br> + * "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> + * "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param certificateUrl the certificateUrl value to set. + * @return the VaultCertificate object itself. + */ + public VaultCertificate withCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + return this; + } + + /** + * Get the certificateStore property: For Windows VMs, specifies the certificate store on the Virtual Machine to + * which the certificate should be added. The specified certificate store is + * implicitly in the LocalMachine account. For Linux VMs, the certificate file is + * placed under the /var/lib/waagent directory, with the file name + * &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and + * &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem + * formatted. + * + * @return the certificateStore value. + */ + public String certificateStore() { + return this.certificateStore; + } + + /** + * Set the certificateStore property: For Windows VMs, specifies the certificate store on the Virtual Machine to + * which the certificate should be added. The specified certificate store is + * implicitly in the LocalMachine account. For Linux VMs, the certificate file is + * placed under the /var/lib/waagent directory, with the file name + * &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and + * &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem + * formatted. + * + * @param certificateStore the certificateStore value to set. + * @return the VaultCertificate object itself. + */ + public VaultCertificate withCertificateStore(String certificateStore) { + this.certificateStore = certificateStore; + 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("certificateUrl", this.certificateUrl); + jsonWriter.writeStringField("certificateStore", this.certificateStore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultCertificate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultCertificate 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 VaultCertificate. + */ + public static VaultCertificate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultCertificate deserializedVaultCertificate = new VaultCertificate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("certificateUrl".equals(fieldName)) { + deserializedVaultCertificate.certificateUrl = reader.getString(); + } else if ("certificateStore".equals(fieldName)) { + deserializedVaultCertificate.certificateStore = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultCertificate; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultSecretGroup.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultSecretGroup.java new file mode 100644 index 0000000000000..d8fbb758814ff --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VaultSecretGroup.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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; + +/** + * Describes a set of certificates which are all in the same Key Vault. + */ +@Fluent +public final class VaultSecretGroup implements JsonSerializable { + /* + * The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + */ + private SubResource sourceVault; + + /* + * The list of key vault references in SourceVault which contain certificates. + */ + private List vaultCertificates; + + /** + * Creates an instance of VaultSecretGroup class. + */ + public VaultSecretGroup() { + } + + /** + * Get the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @return the sourceVault value. + */ + public SubResource sourceVault() { + return this.sourceVault; + } + + /** + * Set the sourceVault property: The relative URL of the Key Vault containing all of the certificates in + * VaultCertificates. + * + * @param sourceVault the sourceVault value to set. + * @return the VaultSecretGroup object itself. + */ + public VaultSecretGroup withSourceVault(SubResource sourceVault) { + this.sourceVault = sourceVault; + return this; + } + + /** + * Get the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @return the vaultCertificates value. + */ + public List vaultCertificates() { + return this.vaultCertificates; + } + + /** + * Set the vaultCertificates property: The list of key vault references in SourceVault which contain certificates. + * + * @param vaultCertificates the vaultCertificates value to set. + * @return the VaultSecretGroup object itself. + */ + public VaultSecretGroup withVaultCertificates(List vaultCertificates) { + this.vaultCertificates = vaultCertificates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vaultCertificates() != null) { + vaultCertificates().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sourceVault", this.sourceVault); + jsonWriter.writeArrayField("vaultCertificates", this.vaultCertificates, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultSecretGroup from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultSecretGroup 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 VaultSecretGroup. + */ + public static VaultSecretGroup fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultSecretGroup deserializedVaultSecretGroup = new VaultSecretGroup(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceVault".equals(fieldName)) { + deserializedVaultSecretGroup.sourceVault = SubResource.fromJson(reader); + } else if ("vaultCertificates".equals(fieldName)) { + List vaultCertificates + = reader.readArray(reader1 -> VaultCertificate.fromJson(reader1)); + deserializedVaultSecretGroup.vaultCertificates = vaultCertificates; + } else { + reader.skipChildren(); + } + } + + return deserializedVaultSecretGroup; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualHardDisk.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualHardDisk.java new file mode 100644 index 0000000000000..a82502d618969 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualHardDisk.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the uri of a disk. + */ +@Fluent +public final class VirtualHardDisk implements JsonSerializable { + /* + * Specifies the virtual hard disk's uri. + */ + private String uri; + + /** + * Creates an instance of VirtualHardDisk class. + */ + public VirtualHardDisk() { + } + + /** + * Get the uri property: Specifies the virtual hard disk's uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: Specifies the virtual hard disk's uri. + * + * @param uri the uri value to set. + * @return the VirtualHardDisk object itself. + */ + public VirtualHardDisk withUri(String uri) { + this.uri = uri; + 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("uri", this.uri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDisk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDisk 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 VirtualHardDisk. + */ + public static VirtualHardDisk fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDisk deserializedVirtualHardDisk = new VirtualHardDisk(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uri".equals(fieldName)) { + deserializedVirtualHardDisk.uri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDisk; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSet.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSet.java new file mode 100644 index 0000000000000..42df23c0c4157 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSet.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; + +/** + * An immutable client-side representation of VirtualMachineScaleSet. + */ +public interface VirtualMachineScaleSet { + /** + * Gets the name property: The name of the virtualMachineScaleSet. + * + * @return the name value. + */ + String name(); + + /** + * Gets the id property: The compute RP resource id of the virtualMachineScaleSet + * "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}". + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: Type of the virtualMachineScaleSet. + * + * @return the type value. + */ + String type(); + + /** + * Gets the operationStatus property: This represents the operationStatus of the VMSS in response to the last + * operation that was performed on it by Azure Fleet resource. + * + * @return the operationStatus value. + */ + ProvisioningState operationStatus(); + + /** + * Gets the error property: Error Information when `operationStatus` is `Failed`. + * + * @return the error value. + */ + ApiError error(); + + /** + * Gets the inner com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner object. + * + * @return the inner object. + */ + VirtualMachineScaleSetInner innerModel(); +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetDataDisk.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetDataDisk.java new file mode 100644 index 0000000000000..913294aff80c6 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetDataDisk.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set data disk. + */ +@Fluent +public final class VirtualMachineScaleSetDataDisk implements JsonSerializable { + /* + * The disk name. + */ + private String name; + + /* + * Specifies the logical unit number of the data disk. This value is used to + * identify data disks within the VM and therefore must be unique for each data + * disk attached to a VM. + */ + private int lun; + + /* + * Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.** + */ + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the disk. + */ + private Boolean writeAcceleratorEnabled; + + /* + * The create option. + */ + private DiskCreateOptionTypes createOption; + + /* + * Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property + * diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be + * larger than 1023. + */ + private Integer diskSizeGB; + + /* + * The managed disk parameters. + */ + private VirtualMachineScaleSetManagedDiskParameters managedDisk; + + /* + * Specifies the Read-Write IOPS for the managed disk. Should be used only when + * StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + * assigned based on diskSizeGB. + */ + private Long diskIopsReadWrite; + + /* + * Specifies the bandwidth in MB per second for the managed disk. Should be used + * only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + * would be assigned based on diskSizeGB. + */ + private Long diskMBpsReadWrite; + + /* + * Specifies whether data disk should be deleted or detached upon VMSS Flex + * deletion (This feature is available for VMSS with Flexible OrchestrationMode + * only).

Possible values:

**Delete** If this value is used, the + * data disk is deleted when the VMSS Flex VM is deleted.

**Detach** If + * this value is used, the data disk is retained after VMSS Flex VM is + * deleted.

The default value is set to **Delete**. + */ + private DiskDeleteOptionTypes deleteOption; + + /** + * Creates an instance of VirtualMachineScaleSetDataDisk class. + */ + public VirtualMachineScaleSetDataDisk() { + } + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to + * identify data disks within the VM and therefore must be unique for each data + * disk attached to a VM. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: Specifies the logical unit number of the data disk. This value is used to + * identify data disks within the VM and therefore must be unique for each data + * disk attached to a VM. + * + * @param lun the lun value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.**. + * + * @param caching the caching value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the createOption property: The create option. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: The create option. + * + * @param createOption the createOption value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property + * diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be + * larger than 1023. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property + * diskSizeGB is the number of bytes x 1024^3 for the disk and the value cannot be + * larger than 1023. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineScaleSetManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withManagedDisk(VirtualMachineScaleSetManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the diskIopsReadWrite property: Specifies the Read-Write IOPS for the managed disk. Should be used only when + * StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + * assigned based on diskSizeGB. + * + * @return the diskIopsReadWrite value. + */ + public Long diskIopsReadWrite() { + return this.diskIopsReadWrite; + } + + /** + * Set the diskIopsReadWrite property: Specifies the Read-Write IOPS for the managed disk. Should be used only when + * StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + * assigned based on diskSizeGB. + * + * @param diskIopsReadWrite the diskIopsReadWrite value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskIopsReadWrite(Long diskIopsReadWrite) { + this.diskIopsReadWrite = diskIopsReadWrite; + return this; + } + + /** + * Get the diskMBpsReadWrite property: Specifies the bandwidth in MB per second for the managed disk. Should be used + * only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + * would be assigned based on diskSizeGB. + * + * @return the diskMBpsReadWrite value. + */ + public Long diskMBpsReadWrite() { + return this.diskMBpsReadWrite; + } + + /** + * Set the diskMBpsReadWrite property: Specifies the bandwidth in MB per second for the managed disk. Should be used + * only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + * would be assigned based on diskSizeGB. + * + * @param diskMBpsReadWrite the diskMBpsReadWrite value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDiskMBpsReadWrite(Long diskMBpsReadWrite) { + this.diskMBpsReadWrite = diskMBpsReadWrite; + return this; + } + + /** + * Get the deleteOption property: Specifies whether data disk should be deleted or detached upon VMSS Flex + * deletion (This feature is available for VMSS with Flexible OrchestrationMode + * only).<br><br> Possible values: <br><br> **Delete** If this value is used, the + * data disk is deleted when the VMSS Flex VM is deleted.<br><br> **Detach** If + * this value is used, the data disk is retained after VMSS Flex VM is + * deleted.<br><br> The default value is set to **Delete**. + * + * @return the deleteOption value. + */ + public DiskDeleteOptionTypes deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specifies whether data disk should be deleted or detached upon VMSS Flex + * deletion (This feature is available for VMSS with Flexible OrchestrationMode + * only).<br><br> Possible values: <br><br> **Delete** If this value is used, the + * data disk is deleted when the VMSS Flex VM is deleted.<br><br> **Detach** If + * this value is used, the data disk is retained after VMSS Flex VM is + * deleted.<br><br> The default value is set to **Delete**. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetDataDisk object itself. + */ + public VirtualMachineScaleSetDataDisk withDeleteOption(DiskDeleteOptionTypes deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createOption() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property createOption in model VirtualMachineScaleSetDataDisk")); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineScaleSetDataDisk.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("lun", this.lun); + jsonWriter.writeStringField("createOption", this.createOption == null ? null : this.createOption.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("caching", this.caching == null ? null : this.caching.toString()); + jsonWriter.writeBooleanField("writeAcceleratorEnabled", this.writeAcceleratorEnabled); + jsonWriter.writeNumberField("diskSizeGB", this.diskSizeGB); + jsonWriter.writeJsonField("managedDisk", this.managedDisk); + jsonWriter.writeNumberField("diskIOPSReadWrite", this.diskIopsReadWrite); + jsonWriter.writeNumberField("diskMBpsReadWrite", this.diskMBpsReadWrite); + jsonWriter.writeStringField("deleteOption", this.deleteOption == null ? null : this.deleteOption.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetDataDisk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetDataDisk 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 VirtualMachineScaleSetDataDisk. + */ + public static VirtualMachineScaleSetDataDisk fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetDataDisk deserializedVirtualMachineScaleSetDataDisk + = new VirtualMachineScaleSetDataDisk(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lun".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.lun = reader.getInt(); + } else if ("createOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.createOption + = DiskCreateOptionTypes.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.name = reader.getString(); + } else if ("caching".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.caching = CachingTypes.fromString(reader.getString()); + } else if ("writeAcceleratorEnabled".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.writeAcceleratorEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("diskSizeGB".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.diskSizeGB = reader.getNullable(JsonReader::getInt); + } else if ("managedDisk".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.managedDisk + = VirtualMachineScaleSetManagedDiskParameters.fromJson(reader); + } else if ("diskIOPSReadWrite".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.diskIopsReadWrite + = reader.getNullable(JsonReader::getLong); + } else if ("diskMBpsReadWrite".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.diskMBpsReadWrite + = reader.getNullable(JsonReader::getLong); + } else if ("deleteOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetDataDisk.deleteOption + = DiskDeleteOptionTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetDataDisk; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtension.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtension.java new file mode 100644 index 0000000000000..89a6c023a1e1a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtension.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a Virtual Machine Scale Set Extension. + */ +@Fluent +public final class VirtualMachineScaleSetExtension implements JsonSerializable { + /* + * Resource Id + */ + private String id; + + /* + * The name of the extension. + */ + private String name; + + /* + * Resource type + */ + private String type; + + /* + * Describes the properties of a Virtual Machine Scale Set Extension. + */ + private VirtualMachineScaleSetExtensionProperties properties; + + /** + * Creates an instance of VirtualMachineScaleSetExtension class. + */ + public VirtualMachineScaleSetExtension() { + } + + /** + * Get the id property: Resource Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the extension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the extension. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetExtension object itself. + */ + public VirtualMachineScaleSetExtension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the properties property: Describes the properties of a Virtual Machine Scale Set Extension. + * + * @return the properties value. + */ + public VirtualMachineScaleSetExtensionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes the properties of a Virtual Machine Scale Set Extension. + * + * @param properties the properties value to set. + * @return the VirtualMachineScaleSetExtension object itself. + */ + public VirtualMachineScaleSetExtension withProperties(VirtualMachineScaleSetExtensionProperties 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.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetExtension from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetExtension 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 VirtualMachineScaleSetExtension. + */ + public static VirtualMachineScaleSetExtension fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetExtension deserializedVirtualMachineScaleSetExtension + = new VirtualMachineScaleSetExtension(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtension.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtension.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtension.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtension.properties + = VirtualMachineScaleSetExtensionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetExtension; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProfile.java new file mode 100644 index 0000000000000..8aa0d8a8fd78d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProfile.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set extension profile. + */ +@Fluent +public final class VirtualMachineScaleSetExtensionProfile + implements JsonSerializable { + /* + * The virtual machine scale set child extension resources. + */ + private List extensions; + + /* + * Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be + * specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). + * Minimum api-version: 2020-06-01. + */ + private String extensionsTimeBudget; + + /** + * Creates an instance of VirtualMachineScaleSetExtensionProfile class. + */ + public VirtualMachineScaleSetExtensionProfile() { + } + + /** + * Get the extensions property: The virtual machine scale set child extension resources. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: The virtual machine scale set child extension resources. + * + * @param extensions the extensions value to set. + * @return the VirtualMachineScaleSetExtensionProfile object itself. + */ + public VirtualMachineScaleSetExtensionProfile withExtensions(List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be + * specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). + * Minimum api-version: 2020-06-01. + * + * @return the extensionsTimeBudget value. + */ + public String extensionsTimeBudget() { + return this.extensionsTimeBudget; + } + + /** + * Set the extensionsTimeBudget property: Specifies the time alloted for all extensions to start. The time duration + * should be between 15 minutes and 120 minutes (inclusive) and should be + * specified in ISO 8601 format. The default value is 90 minutes (PT1H30M). + * Minimum api-version: 2020-06-01. + * + * @param extensionsTimeBudget the extensionsTimeBudget value to set. + * @return the VirtualMachineScaleSetExtensionProfile object itself. + */ + public VirtualMachineScaleSetExtensionProfile withExtensionsTimeBudget(String extensionsTimeBudget) { + this.extensionsTimeBudget = extensionsTimeBudget; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("extensions", this.extensions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("extensionsTimeBudget", this.extensionsTimeBudget); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetExtensionProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetExtensionProfile 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 VirtualMachineScaleSetExtensionProfile. + */ + public static VirtualMachineScaleSetExtensionProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetExtensionProfile deserializedVirtualMachineScaleSetExtensionProfile + = new VirtualMachineScaleSetExtensionProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("extensions".equals(fieldName)) { + List extensions + = reader.readArray(reader1 -> VirtualMachineScaleSetExtension.fromJson(reader1)); + deserializedVirtualMachineScaleSetExtensionProfile.extensions = extensions; + } else if ("extensionsTimeBudget".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProfile.extensionsTimeBudget = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetExtensionProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProperties.java new file mode 100644 index 0000000000000..62dd0222c9812 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetExtensionProperties.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; +import java.util.Map; + +/** + * Describes the properties of a Virtual Machine Scale Set Extension. + */ +@Fluent +public final class VirtualMachineScaleSetExtensionProperties + implements JsonSerializable { + /* + * If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not + * changed. + */ + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + private String publisher; + + /* + * Specifies the type of the extension; an example is "CustomScriptExtension". + */ + private String type; + + /* + * Specifies the version of the script handler. + */ + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not + * upgrade minor versions unless redeployed, even with this property set to true. + */ + private Boolean autoUpgradeMinorVersion; + + /* + * Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + */ + private Boolean enableAutomaticUpgrade; + + /* + * Json formatted public settings for the extension. + */ + private Map settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + private Map protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + private String provisioningState; + + /* + * Collection of extension names after which this extension needs to be + * provisioned. + */ + private List provisionAfterExtensions; + + /* + * Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed + * regardless of this value). The default is false. + */ + private Boolean suppressFailures; + + /* + * The extensions protected settings that are passed by reference, and consumed + * from key vault + */ + private KeyVaultSecretReference protectedSettingsFromKeyVault; + + /** + * Creates an instance of VirtualMachineScaleSetExtensionProperties class. + */ + public VirtualMachineScaleSetExtensionProperties() { + } + + /** + * Get the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not + * changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: If a value is provided and is different from the previous value, the extension + * handler will be forced to update even if the extension configuration has not + * changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is + * available at deployment time. Once deployed, however, the extension will not + * upgrade minor versions unless redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is + * available at deployment time. Once deployed, however, the extension will not + * upgrade minor versions unless redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @return the enableAutomaticUpgrade value. + */ + public Boolean enableAutomaticUpgrade() { + return this.enableAutomaticUpgrade; + } + + /** + * Set the enableAutomaticUpgrade property: Indicates whether the extension should be automatically upgraded by the + * platform if there is a newer version of the extension available. + * + * @param enableAutomaticUpgrade the enableAutomaticUpgrade value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withEnableAutomaticUpgrade(Boolean enableAutomaticUpgrade) { + this.enableAutomaticUpgrade = enableAutomaticUpgrade; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Map settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withSettings(Map settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Map protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withProtectedSettings(Map protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + public List provisionAfterExtensions() { + return this.provisionAfterExtensions; + } + + /** + * Set the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @param provisionAfterExtensions the provisionAfterExtensions value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties + withProvisionAfterExtensions(List provisionAfterExtensions) { + this.provisionAfterExtensions = provisionAfterExtensions; + return this; + } + + /** + * Get the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed + * regardless of this value). The default is false. + * + * @return the suppressFailures value. + */ + public Boolean suppressFailures() { + return this.suppressFailures; + } + + /** + * Set the suppressFailures property: Indicates whether failures stemming from the extension will be suppressed + * (Operational failures such as not connecting to the VM will not be suppressed + * regardless of this value). The default is false. + * + * @param suppressFailures the suppressFailures value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties withSuppressFailures(Boolean suppressFailures) { + this.suppressFailures = suppressFailures; + return this; + } + + /** + * Get the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed + * from key vault. + * + * @return the protectedSettingsFromKeyVault value. + */ + public KeyVaultSecretReference protectedSettingsFromKeyVault() { + return this.protectedSettingsFromKeyVault; + } + + /** + * Set the protectedSettingsFromKeyVault property: The extensions protected settings that are passed by reference, + * and consumed + * from key vault. + * + * @param protectedSettingsFromKeyVault the protectedSettingsFromKeyVault value to set. + * @return the VirtualMachineScaleSetExtensionProperties object itself. + */ + public VirtualMachineScaleSetExtensionProperties + withProtectedSettingsFromKeyVault(KeyVaultSecretReference protectedSettingsFromKeyVault) { + this.protectedSettingsFromKeyVault = protectedSettingsFromKeyVault; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (protectedSettingsFromKeyVault() != null) { + protectedSettingsFromKeyVault().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("typeHandlerVersion", this.typeHandlerVersion); + jsonWriter.writeBooleanField("autoUpgradeMinorVersion", this.autoUpgradeMinorVersion); + jsonWriter.writeBooleanField("enableAutomaticUpgrade", this.enableAutomaticUpgrade); + jsonWriter.writeMapField("settings", this.settings, (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeMapField("protectedSettings", this.protectedSettings, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeArrayField("provisionAfterExtensions", this.provisionAfterExtensions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("suppressFailures", this.suppressFailures); + jsonWriter.writeJsonField("protectedSettingsFromKeyVault", this.protectedSettingsFromKeyVault); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetExtensionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetExtensionProperties 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 VirtualMachineScaleSetExtensionProperties. + */ + public static VirtualMachineScaleSetExtensionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetExtensionProperties deserializedVirtualMachineScaleSetExtensionProperties + = new VirtualMachineScaleSetExtensionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("forceUpdateTag".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.forceUpdateTag = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.publisher = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.type = reader.getString(); + } else if ("typeHandlerVersion".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.typeHandlerVersion = reader.getString(); + } else if ("autoUpgradeMinorVersion".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.autoUpgradeMinorVersion + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticUpgrade".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.enableAutomaticUpgrade + = reader.getNullable(JsonReader::getBoolean); + } else if ("settings".equals(fieldName)) { + Map settings = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedVirtualMachineScaleSetExtensionProperties.settings = settings; + } else if ("protectedSettings".equals(fieldName)) { + Map protectedSettings = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedVirtualMachineScaleSetExtensionProperties.protectedSettings = protectedSettings; + } else if ("provisioningState".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.provisioningState = reader.getString(); + } else if ("provisionAfterExtensions".equals(fieldName)) { + List provisionAfterExtensions = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualMachineScaleSetExtensionProperties.provisionAfterExtensions + = provisionAfterExtensions; + } else if ("suppressFailures".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.suppressFailures + = reader.getNullable(JsonReader::getBoolean); + } else if ("protectedSettingsFromKeyVault".equals(fieldName)) { + deserializedVirtualMachineScaleSetExtensionProperties.protectedSettingsFromKeyVault + = KeyVaultSecretReference.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetExtensionProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetHardwareProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetHardwareProfile.java new file mode 100644 index 0000000000000..d97c441e5cc08 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetHardwareProfile.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies the hardware settings for the virtual machine scale set. + */ +@Fluent +public final class VirtualMachineScaleSetHardwareProfile + implements JsonSerializable { + /* + * Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-11-01. Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + */ + private VMSizeProperties vmSizeProperties; + + /** + * Creates an instance of VirtualMachineScaleSetHardwareProfile class. + */ + public VirtualMachineScaleSetHardwareProfile() { + } + + /** + * Get the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-11-01. Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @return the vmSizeProperties value. + */ + public VMSizeProperties vmSizeProperties() { + return this.vmSizeProperties; + } + + /** + * Set the vmSizeProperties property: Specifies the properties for customizing the size of the virtual machine. + * Minimum api-version: 2021-11-01. Please follow the instructions in [VM + * Customization](https://aka.ms/vmcustomization) for more details. + * + * @param vmSizeProperties the vmSizeProperties value to set. + * @return the VirtualMachineScaleSetHardwareProfile object itself. + */ + public VirtualMachineScaleSetHardwareProfile withVmSizeProperties(VMSizeProperties vmSizeProperties) { + this.vmSizeProperties = vmSizeProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmSizeProperties() != null) { + vmSizeProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("vmSizeProperties", this.vmSizeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetHardwareProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetHardwareProfile 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 VirtualMachineScaleSetHardwareProfile. + */ + public static VirtualMachineScaleSetHardwareProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetHardwareProfile deserializedVirtualMachineScaleSetHardwareProfile + = new VirtualMachineScaleSetHardwareProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmSizeProperties".equals(fieldName)) { + deserializedVirtualMachineScaleSetHardwareProfile.vmSizeProperties + = VMSizeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetHardwareProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfiguration.java new file mode 100644 index 0000000000000..f47201a8f2a09 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfiguration.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set network profile's IP configuration. + */ +@Fluent +public final class VirtualMachineScaleSetIpConfiguration + implements JsonSerializable { + /* + * The IP configuration name. + */ + private String name; + + /* + * Describes a virtual machine scale set network profile's IP configuration + * properties. + */ + private VirtualMachineScaleSetIpConfigurationProperties properties; + + /** + * Creates an instance of VirtualMachineScaleSetIpConfiguration class. + */ + public VirtualMachineScaleSetIpConfiguration() { + } + + /** + * Get the name property: The IP configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The IP configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Describes a virtual machine scale set network profile's IP configuration + * properties. + * + * @return the properties value. + */ + public VirtualMachineScaleSetIpConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes a virtual machine scale set network profile's IP configuration + * properties. + * + * @param properties the properties value to set. + * @return the VirtualMachineScaleSetIpConfiguration object itself. + */ + public VirtualMachineScaleSetIpConfiguration + withProperties(VirtualMachineScaleSetIpConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetIpConfiguration")); + } + if (properties() != null) { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineScaleSetIpConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetIpConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetIpConfiguration 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 VirtualMachineScaleSetIpConfiguration. + */ + public static VirtualMachineScaleSetIpConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetIpConfiguration deserializedVirtualMachineScaleSetIpConfiguration + = new VirtualMachineScaleSetIpConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfiguration.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfiguration.properties + = VirtualMachineScaleSetIpConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetIpConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfigurationProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfigurationProperties.java new file mode 100644 index 0000000000000..b6698d3b1ad60 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpConfigurationProperties.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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; + +/** + * Describes a virtual machine scale set network profile's IP configuration + * properties. + */ +@Fluent +public final class VirtualMachineScaleSetIpConfigurationProperties + implements JsonSerializable { + /* + * Specifies the identifier of the subnet. + */ + private ApiEntityReference subnet; + + /* + * Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + */ + private Boolean primary; + + /* + * The publicIPAddressConfiguration. + */ + private VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration; + + /* + * Available from Api-Version 2017-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + */ + private IpVersion privateIpAddressVersion; + + /* + * Specifies an array of references to backend address pools of application + * gateways. A scale set can reference backend address pools of multiple + * application gateways. Multiple scale sets cannot use the same application + * gateway. + */ + private List applicationGatewayBackendAddressPools; + + /* + * Specifies an array of references to application security group. + */ + private List applicationSecurityGroups; + + /* + * Specifies an array of references to backend address pools of load balancers. A + * scale set can reference backend address pools of one public and one internal + * load balancer. Multiple scale sets cannot use the same basic sku load balancer. + */ + private List loadBalancerBackendAddressPools; + + /* + * Specifies an array of references to inbound Nat pools of the load balancers. A + * scale set can reference inbound nat pools of one public and one internal load + * balancer. Multiple scale sets cannot use the same basic sku load balancer. + */ + private List loadBalancerInboundNatPools; + + /** + * Creates an instance of VirtualMachineScaleSetIpConfigurationProperties class. + */ + public VirtualMachineScaleSetIpConfigurationProperties() { + } + + /** + * Get the subnet property: Specifies the identifier of the subnet. + * + * @return the subnet value. + */ + public ApiEntityReference subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Specifies the identifier of the subnet. + * + * @param subnet the subnet value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withSubnet(ApiEntityReference subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @return the publicIpAddressConfiguration value. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.publicIpAddressConfiguration; + } + + /** + * Set the publicIpAddressConfiguration property: The publicIPAddressConfiguration. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties withPublicIpAddressConfiguration( + VirtualMachineScaleSetPublicIpAddressConfiguration publicIpAddressConfiguration) { + this.publicIpAddressConfiguration = publicIpAddressConfiguration; + return this; + } + + /** + * Get the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + * + * @return the privateIpAddressVersion value. + */ + public IpVersion privateIpAddressVersion() { + return this.privateIpAddressVersion; + } + + /** + * Set the privateIpAddressVersion property: Available from Api-Version 2017-03-30 onwards, it represents whether + * the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + * + * @param privateIpAddressVersion the privateIpAddressVersion value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties + withPrivateIpAddressVersion(IpVersion privateIpAddressVersion) { + this.privateIpAddressVersion = privateIpAddressVersion; + return this; + } + + /** + * Get the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application + * gateways. A scale set can reference backend address pools of multiple + * application gateways. Multiple scale sets cannot use the same application + * gateway. + * + * @return the applicationGatewayBackendAddressPools value. + */ + public List applicationGatewayBackendAddressPools() { + return this.applicationGatewayBackendAddressPools; + } + + /** + * Set the applicationGatewayBackendAddressPools property: Specifies an array of references to backend address pools + * of application + * gateways. A scale set can reference backend address pools of multiple + * application gateways. Multiple scale sets cannot use the same application + * gateway. + * + * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties + withApplicationGatewayBackendAddressPools(List applicationGatewayBackendAddressPools) { + this.applicationGatewayBackendAddressPools = applicationGatewayBackendAddressPools; + return this; + } + + /** + * Get the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @return the applicationSecurityGroups value. + */ + public List applicationSecurityGroups() { + return this.applicationSecurityGroups; + } + + /** + * Set the applicationSecurityGroups property: Specifies an array of references to application security group. + * + * @param applicationSecurityGroups the applicationSecurityGroups value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties + withApplicationSecurityGroups(List applicationSecurityGroups) { + this.applicationSecurityGroups = applicationSecurityGroups; + return this; + } + + /** + * Get the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A + * scale set can reference backend address pools of one public and one internal + * load balancer. Multiple scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerBackendAddressPools value. + */ + public List loadBalancerBackendAddressPools() { + return this.loadBalancerBackendAddressPools; + } + + /** + * Set the loadBalancerBackendAddressPools property: Specifies an array of references to backend address pools of + * load balancers. A + * scale set can reference backend address pools of one public and one internal + * load balancer. Multiple scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties + withLoadBalancerBackendAddressPools(List loadBalancerBackendAddressPools) { + this.loadBalancerBackendAddressPools = loadBalancerBackendAddressPools; + return this; + } + + /** + * Get the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A + * scale set can reference inbound nat pools of one public and one internal load + * balancer. Multiple scale sets cannot use the same basic sku load balancer. + * + * @return the loadBalancerInboundNatPools value. + */ + public List loadBalancerInboundNatPools() { + return this.loadBalancerInboundNatPools; + } + + /** + * Set the loadBalancerInboundNatPools property: Specifies an array of references to inbound Nat pools of the load + * balancers. A + * scale set can reference inbound nat pools of one public and one internal load + * balancer. Multiple scale sets cannot use the same basic sku load balancer. + * + * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set. + * @return the VirtualMachineScaleSetIpConfigurationProperties object itself. + */ + public VirtualMachineScaleSetIpConfigurationProperties + withLoadBalancerInboundNatPools(List loadBalancerInboundNatPools) { + this.loadBalancerInboundNatPools = loadBalancerInboundNatPools; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnet() != null) { + subnet().validate(); + } + if (publicIpAddressConfiguration() != null) { + publicIpAddressConfiguration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("subnet", this.subnet); + jsonWriter.writeBooleanField("primary", this.primary); + jsonWriter.writeJsonField("publicIPAddressConfiguration", this.publicIpAddressConfiguration); + jsonWriter.writeStringField("privateIPAddressVersion", + this.privateIpAddressVersion == null ? null : this.privateIpAddressVersion.toString()); + jsonWriter.writeArrayField("applicationGatewayBackendAddressPools", this.applicationGatewayBackendAddressPools, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("applicationSecurityGroups", this.applicationSecurityGroups, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("loadBalancerBackendAddressPools", this.loadBalancerBackendAddressPools, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("loadBalancerInboundNatPools", this.loadBalancerInboundNatPools, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetIpConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetIpConfigurationProperties 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 VirtualMachineScaleSetIpConfigurationProperties. + */ + public static VirtualMachineScaleSetIpConfigurationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetIpConfigurationProperties deserializedVirtualMachineScaleSetIpConfigurationProperties + = new VirtualMachineScaleSetIpConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subnet".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfigurationProperties.subnet + = ApiEntityReference.fromJson(reader); + } else if ("primary".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfigurationProperties.primary + = reader.getNullable(JsonReader::getBoolean); + } else if ("publicIPAddressConfiguration".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfigurationProperties.publicIpAddressConfiguration + = VirtualMachineScaleSetPublicIpAddressConfiguration.fromJson(reader); + } else if ("privateIPAddressVersion".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpConfigurationProperties.privateIpAddressVersion + = IpVersion.fromString(reader.getString()); + } else if ("applicationGatewayBackendAddressPools".equals(fieldName)) { + List applicationGatewayBackendAddressPools + = reader.readArray(reader1 -> SubResource.fromJson(reader1)); + deserializedVirtualMachineScaleSetIpConfigurationProperties.applicationGatewayBackendAddressPools + = applicationGatewayBackendAddressPools; + } else if ("applicationSecurityGroups".equals(fieldName)) { + List applicationSecurityGroups + = reader.readArray(reader1 -> SubResource.fromJson(reader1)); + deserializedVirtualMachineScaleSetIpConfigurationProperties.applicationSecurityGroups + = applicationSecurityGroups; + } else if ("loadBalancerBackendAddressPools".equals(fieldName)) { + List loadBalancerBackendAddressPools + = reader.readArray(reader1 -> SubResource.fromJson(reader1)); + deserializedVirtualMachineScaleSetIpConfigurationProperties.loadBalancerBackendAddressPools + = loadBalancerBackendAddressPools; + } else if ("loadBalancerInboundNatPools".equals(fieldName)) { + List loadBalancerInboundNatPools + = reader.readArray(reader1 -> SubResource.fromJson(reader1)); + deserializedVirtualMachineScaleSetIpConfigurationProperties.loadBalancerInboundNatPools + = loadBalancerInboundNatPools; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetIpConfigurationProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpTag.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpTag.java new file mode 100644 index 0000000000000..94ef79159f30a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetIpTag.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Contains the IP tag associated with the public IP address. + */ +@Fluent +public final class VirtualMachineScaleSetIpTag implements JsonSerializable { + /* + * IP tag type. Example: FirstPartyUsage. + */ + private String ipTagType; + + /* + * IP tag associated with the public IP. Example: SQL, Storage etc. + */ + private String tag; + + /** + * Creates an instance of VirtualMachineScaleSetIpTag class. + */ + public VirtualMachineScaleSetIpTag() { + } + + /** + * Get the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @return the ipTagType value. + */ + public String ipTagType() { + return this.ipTagType; + } + + /** + * Set the ipTagType property: IP tag type. Example: FirstPartyUsage. + * + * @param ipTagType the ipTagType value to set. + * @return the VirtualMachineScaleSetIpTag object itself. + */ + public VirtualMachineScaleSetIpTag withIpTagType(String ipTagType) { + this.ipTagType = ipTagType; + return this; + } + + /** + * Get the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Set the tag property: IP tag associated with the public IP. Example: SQL, Storage etc. + * + * @param tag the tag value to set. + * @return the VirtualMachineScaleSetIpTag object itself. + */ + public VirtualMachineScaleSetIpTag withTag(String tag) { + this.tag = tag; + 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("ipTagType", this.ipTagType); + jsonWriter.writeStringField("tag", this.tag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetIpTag from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetIpTag 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 VirtualMachineScaleSetIpTag. + */ + public static VirtualMachineScaleSetIpTag fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetIpTag deserializedVirtualMachineScaleSetIpTag = new VirtualMachineScaleSetIpTag(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipTagType".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpTag.ipTagType = reader.getString(); + } else if ("tag".equals(fieldName)) { + deserializedVirtualMachineScaleSetIpTag.tag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetIpTag; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetListResult.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetListResult.java new file mode 100644 index 0000000000000..9d8c96fba4914 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetListResult.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurefleet.fluent.models.VirtualMachineScaleSetInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a VirtualMachineScaleSet list operation. + */ +@Fluent +public final class VirtualMachineScaleSetListResult implements JsonSerializable { + /* + * The VirtualMachineScaleSet items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of VirtualMachineScaleSetListResult class. + */ + public VirtualMachineScaleSetListResult() { + } + + /** + * Get the value property: The VirtualMachineScaleSet items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The VirtualMachineScaleSet items on this page. + * + * @param value the value value to set. + * @return the VirtualMachineScaleSetListResult object itself. + */ + public VirtualMachineScaleSetListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineScaleSetListResult object itself. + */ + public VirtualMachineScaleSetListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model VirtualMachineScaleSetListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineScaleSetListResult.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 VirtualMachineScaleSetListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetListResult 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 VirtualMachineScaleSetListResult. + */ + public static VirtualMachineScaleSetListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetListResult deserializedVirtualMachineScaleSetListResult + = new VirtualMachineScaleSetListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> VirtualMachineScaleSetInner.fromJson(reader1)); + deserializedVirtualMachineScaleSetListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVirtualMachineScaleSetListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetListResult; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetManagedDiskParameters.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetManagedDiskParameters.java new file mode 100644 index 0000000000000..bcb0f28133a29 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetManagedDiskParameters.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes the parameters of a ScaleSet managed disk. + */ +@Fluent +public final class VirtualMachineScaleSetManagedDiskParameters + implements JsonSerializable { + /* + * Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can + * only be used with data disks, it cannot be used with OS Disk. + */ + private StorageAccountTypes storageAccountType; + + /* + * Specifies the customer managed disk encryption set resource id for the managed + * disk. + */ + private DiskEncryptionSetParameters diskEncryptionSet; + + /* + * Specifies the security profile for the managed disk. + */ + private VMDiskSecurityProfile securityProfile; + + /** + * Creates an instance of VirtualMachineScaleSetManagedDiskParameters class. + */ + public VirtualMachineScaleSetManagedDiskParameters() { + } + + /** + * Get the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can + * only be used with data disks, it cannot be used with OS Disk. + * + * @return the storageAccountType value. + */ + public StorageAccountTypes storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS + * can + * only be used with data disks, it cannot be used with OS Disk. + * + * @param storageAccountType the storageAccountType value to set. + * @return the VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters withStorageAccountType(StorageAccountTypes storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Get the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed + * disk. + * + * @return the diskEncryptionSet value. + */ + public DiskEncryptionSetParameters diskEncryptionSet() { + return this.diskEncryptionSet; + } + + /** + * Set the diskEncryptionSet property: Specifies the customer managed disk encryption set resource id for the + * managed + * disk. + * + * @param diskEncryptionSet the diskEncryptionSet value to set. + * @return the VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters + withDiskEncryptionSet(DiskEncryptionSetParameters diskEncryptionSet) { + this.diskEncryptionSet = diskEncryptionSet; + return this; + } + + /** + * Get the securityProfile property: Specifies the security profile for the managed disk. + * + * @return the securityProfile value. + */ + public VMDiskSecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the security profile for the managed disk. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineScaleSetManagedDiskParameters object itself. + */ + public VirtualMachineScaleSetManagedDiskParameters withSecurityProfile(VMDiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (diskEncryptionSet() != null) { + diskEncryptionSet().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageAccountType", + this.storageAccountType == null ? null : this.storageAccountType.toString()); + jsonWriter.writeJsonField("diskEncryptionSet", this.diskEncryptionSet); + jsonWriter.writeJsonField("securityProfile", this.securityProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetManagedDiskParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetManagedDiskParameters 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 VirtualMachineScaleSetManagedDiskParameters. + */ + public static VirtualMachineScaleSetManagedDiskParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetManagedDiskParameters deserializedVirtualMachineScaleSetManagedDiskParameters + = new VirtualMachineScaleSetManagedDiskParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageAccountType".equals(fieldName)) { + deserializedVirtualMachineScaleSetManagedDiskParameters.storageAccountType + = StorageAccountTypes.fromString(reader.getString()); + } else if ("diskEncryptionSet".equals(fieldName)) { + deserializedVirtualMachineScaleSetManagedDiskParameters.diskEncryptionSet + = DiskEncryptionSetParameters.fromJson(reader); + } else if ("securityProfile".equals(fieldName)) { + deserializedVirtualMachineScaleSetManagedDiskParameters.securityProfile + = VMDiskSecurityProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetManagedDiskParameters; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfiguration.java new file mode 100644 index 0000000000000..19a8d2fb88f1d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfiguration.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set network profile's network configurations. + */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfiguration + implements JsonSerializable { + /* + * The network configuration name. + */ + private String name; + + /* + * Describes a virtual machine scale set network profile's IP configuration. + */ + private VirtualMachineScaleSetNetworkConfigurationProperties properties; + + /** + * Creates an instance of VirtualMachineScaleSetNetworkConfiguration class. + */ + public VirtualMachineScaleSetNetworkConfiguration() { + } + + /** + * Get the name property: The network configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The network configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Describes a virtual machine scale set network profile's IP configuration. + * + * @return the properties value. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes a virtual machine scale set network profile's IP configuration. + * + * @param properties the properties value to set. + * @return the VirtualMachineScaleSetNetworkConfiguration object itself. + */ + public VirtualMachineScaleSetNetworkConfiguration + withProperties(VirtualMachineScaleSetNetworkConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetNetworkConfiguration")); + } + if (properties() != null) { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineScaleSetNetworkConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetNetworkConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetNetworkConfiguration 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 VirtualMachineScaleSetNetworkConfiguration. + */ + public static VirtualMachineScaleSetNetworkConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetNetworkConfiguration deserializedVirtualMachineScaleSetNetworkConfiguration + = new VirtualMachineScaleSetNetworkConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfiguration.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfiguration.properties + = VirtualMachineScaleSetNetworkConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetNetworkConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java new file mode 100644 index 0000000000000..f9192275c4e41 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machines scale sets network configuration's DNS settings. + */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfigurationDnsSettings + implements JsonSerializable { + /* + * List of DNS servers IP addresses + */ + private List dnsServers; + + /** + * Creates an instance of VirtualMachineScaleSetNetworkConfigurationDnsSettings class. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings() { + } + + /** + * Get the dnsServers property: List of DNS servers IP addresses. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: List of DNS servers IP addresses. + * + * @param dnsServers the dnsServers value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationDnsSettings object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + 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.writeArrayField("dnsServers", this.dnsServers, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetNetworkConfigurationDnsSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetNetworkConfigurationDnsSettings 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 VirtualMachineScaleSetNetworkConfigurationDnsSettings. + */ + public static VirtualMachineScaleSetNetworkConfigurationDnsSettings fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetNetworkConfigurationDnsSettings deserializedVirtualMachineScaleSetNetworkConfigurationDnsSettings + = new VirtualMachineScaleSetNetworkConfigurationDnsSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualMachineScaleSetNetworkConfigurationDnsSettings.dnsServers = dnsServers; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetNetworkConfigurationDnsSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationProperties.java new file mode 100644 index 0000000000000..be728aa4616b9 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkConfigurationProperties.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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; +import java.util.List; + +/** + * Describes a virtual machine scale set network profile's IP configuration. + */ +@Fluent +public final class VirtualMachineScaleSetNetworkConfigurationProperties + implements JsonSerializable { + /* + * Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + */ + private Boolean primary; + + /* + * Specifies whether the network interface is accelerated networking-enabled. + */ + private Boolean enableAcceleratedNetworking; + + /* + * Specifies whether the network interface is disabled for tcp state tracking. + */ + private Boolean disableTcpStateTracking; + + /* + * Specifies whether the network interface is FPGA networking-enabled. + */ + private Boolean enableFpga; + + /* + * The network security group. + */ + private SubResource networkSecurityGroup; + + /* + * The dns settings to be applied on the network interfaces. + */ + private VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings; + + /* + * Specifies the IP configurations of the network interface. + */ + private List ipConfigurations; + + /* + * Whether IP forwarding enabled on this NIC. + */ + private Boolean enableIpForwarding; + + /* + * Specify what happens to the network interface when the VM is deleted + */ + private DeleteOptions deleteOption; + + /* + * Specifies whether the Auxiliary mode is enabled for the Network Interface + * resource. + */ + private NetworkInterfaceAuxiliaryMode auxiliaryMode; + + /* + * Specifies whether the Auxiliary sku is enabled for the Network Interface + * resource. + */ + private NetworkInterfaceAuxiliarySku auxiliarySku; + + /** + * Creates an instance of VirtualMachineScaleSetNetworkConfigurationProperties class. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties() { + } + + /** + * Get the primary property: Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + * + * @return the primary value. + */ + public Boolean primary() { + return this.primary; + } + + /** + * Set the primary property: Specifies the primary network interface in case the virtual machine has more + * than 1 network interface. + * + * @param primary the primary value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withPrimary(Boolean primary) { + this.primary = primary; + return this; + } + + /** + * Get the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @return the enableAcceleratedNetworking value. + */ + public Boolean enableAcceleratedNetworking() { + return this.enableAcceleratedNetworking; + } + + /** + * Set the enableAcceleratedNetworking property: Specifies whether the network interface is accelerated + * networking-enabled. + * + * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withEnableAcceleratedNetworking(Boolean enableAcceleratedNetworking) { + this.enableAcceleratedNetworking = enableAcceleratedNetworking; + return this; + } + + /** + * Get the disableTcpStateTracking property: Specifies whether the network interface is disabled for tcp state + * tracking. + * + * @return the disableTcpStateTracking value. + */ + public Boolean disableTcpStateTracking() { + return this.disableTcpStateTracking; + } + + /** + * Set the disableTcpStateTracking property: Specifies whether the network interface is disabled for tcp state + * tracking. + * + * @param disableTcpStateTracking the disableTcpStateTracking value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withDisableTcpStateTracking(Boolean disableTcpStateTracking) { + this.disableTcpStateTracking = disableTcpStateTracking; + return this; + } + + /** + * Get the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @return the enableFpga value. + */ + public Boolean enableFpga() { + return this.enableFpga; + } + + /** + * Set the enableFpga property: Specifies whether the network interface is FPGA networking-enabled. + * + * @param enableFpga the enableFpga value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withEnableFpga(Boolean enableFpga) { + this.enableFpga = enableFpga; + return this; + } + + /** + * Get the networkSecurityGroup property: The network security group. + * + * @return the networkSecurityGroup value. + */ + public SubResource networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: The network security group. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withNetworkSecurityGroup(SubResource networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the network interfaces. + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withDnsSettings(VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.ipConfigurations; + } + + /** + * Set the ipConfigurations property: Specifies the IP configurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withIpConfigurations(List ipConfigurations) { + this.ipConfigurations = ipConfigurations; + return this; + } + + /** + * Get the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @return the enableIpForwarding value. + */ + public Boolean enableIpForwarding() { + return this.enableIpForwarding; + } + + /** + * Set the enableIpForwarding property: Whether IP forwarding enabled on this NIC. + * + * @param enableIpForwarding the enableIpForwarding value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withEnableIpForwarding(Boolean enableIpForwarding) { + this.enableIpForwarding = enableIpForwarding; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the network interface when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Get the auxiliaryMode property: Specifies whether the Auxiliary mode is enabled for the Network Interface + * resource. + * + * @return the auxiliaryMode value. + */ + public NetworkInterfaceAuxiliaryMode auxiliaryMode() { + return this.auxiliaryMode; + } + + /** + * Set the auxiliaryMode property: Specifies whether the Auxiliary mode is enabled for the Network Interface + * resource. + * + * @param auxiliaryMode the auxiliaryMode value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withAuxiliaryMode(NetworkInterfaceAuxiliaryMode auxiliaryMode) { + this.auxiliaryMode = auxiliaryMode; + return this; + } + + /** + * Get the auxiliarySku property: Specifies whether the Auxiliary sku is enabled for the Network Interface + * resource. + * + * @return the auxiliarySku value. + */ + public NetworkInterfaceAuxiliarySku auxiliarySku() { + return this.auxiliarySku; + } + + /** + * Set the auxiliarySku property: Specifies whether the Auxiliary sku is enabled for the Network Interface + * resource. + * + * @param auxiliarySku the auxiliarySku value to set. + * @return the VirtualMachineScaleSetNetworkConfigurationProperties object itself. + */ + public VirtualMachineScaleSetNetworkConfigurationProperties + withAuxiliarySku(NetworkInterfaceAuxiliarySku auxiliarySku) { + this.auxiliarySku = auxiliarySku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipConfigurations() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ipConfigurations in model VirtualMachineScaleSetNetworkConfigurationProperties")); + } else { + ipConfigurations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(VirtualMachineScaleSetNetworkConfigurationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ipConfigurations", this.ipConfigurations, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("primary", this.primary); + jsonWriter.writeBooleanField("enableAcceleratedNetworking", this.enableAcceleratedNetworking); + jsonWriter.writeBooleanField("disableTcpStateTracking", this.disableTcpStateTracking); + jsonWriter.writeBooleanField("enableFpga", this.enableFpga); + jsonWriter.writeJsonField("networkSecurityGroup", this.networkSecurityGroup); + jsonWriter.writeJsonField("dnsSettings", this.dnsSettings); + jsonWriter.writeBooleanField("enableIPForwarding", this.enableIpForwarding); + jsonWriter.writeStringField("deleteOption", this.deleteOption == null ? null : this.deleteOption.toString()); + jsonWriter.writeStringField("auxiliaryMode", this.auxiliaryMode == null ? null : this.auxiliaryMode.toString()); + jsonWriter.writeStringField("auxiliarySku", this.auxiliarySku == null ? null : this.auxiliarySku.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetNetworkConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetNetworkConfigurationProperties 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 VirtualMachineScaleSetNetworkConfigurationProperties. + */ + public static VirtualMachineScaleSetNetworkConfigurationProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetNetworkConfigurationProperties deserializedVirtualMachineScaleSetNetworkConfigurationProperties + = new VirtualMachineScaleSetNetworkConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipConfigurations".equals(fieldName)) { + List ipConfigurations + = reader.readArray(reader1 -> VirtualMachineScaleSetIpConfiguration.fromJson(reader1)); + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.ipConfigurations + = ipConfigurations; + } else if ("primary".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.primary + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAcceleratedNetworking".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.enableAcceleratedNetworking + = reader.getNullable(JsonReader::getBoolean); + } else if ("disableTcpStateTracking".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.disableTcpStateTracking + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableFpga".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.enableFpga + = reader.getNullable(JsonReader::getBoolean); + } else if ("networkSecurityGroup".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.networkSecurityGroup + = SubResource.fromJson(reader); + } else if ("dnsSettings".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.dnsSettings + = VirtualMachineScaleSetNetworkConfigurationDnsSettings.fromJson(reader); + } else if ("enableIPForwarding".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.enableIpForwarding + = reader.getNullable(JsonReader::getBoolean); + } else if ("deleteOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.deleteOption + = DeleteOptions.fromString(reader.getString()); + } else if ("auxiliaryMode".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.auxiliaryMode + = NetworkInterfaceAuxiliaryMode.fromString(reader.getString()); + } else if ("auxiliarySku".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkConfigurationProperties.auxiliarySku + = NetworkInterfaceAuxiliarySku.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetNetworkConfigurationProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkProfile.java new file mode 100644 index 0000000000000..246dfebb148f3 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetNetworkProfile.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set network profile. + */ +@Fluent +public final class VirtualMachineScaleSetNetworkProfile + implements JsonSerializable { + /* + * A reference to a load balancer probe used to determine the health of an + * instance in the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{ + * loadBalancerName}/probes/{probeName}'. + */ + private ApiEntityReference healthProbe; + + /* + * The list of network configurations. + */ + private List networkInterfaceConfigurations; + + /* + * specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set + * with orchestration mode 'Flexible' + */ + private NetworkApiVersion networkApiVersion; + + /** + * Creates an instance of VirtualMachineScaleSetNetworkProfile class. + */ + public VirtualMachineScaleSetNetworkProfile() { + } + + /** + * Get the healthProbe property: A reference to a load balancer probe used to determine the health of an + * instance in the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @return the healthProbe value. + */ + public ApiEntityReference healthProbe() { + return this.healthProbe; + } + + /** + * Set the healthProbe property: A reference to a load balancer probe used to determine the health of an + * instance in the virtual machine scale set. The reference will be in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + * + * @param healthProbe the healthProbe value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withHealthProbe(ApiEntityReference healthProbe) { + this.healthProbe = healthProbe; + return this; + } + + /** + * Get the networkInterfaceConfigurations property: The list of network configurations. + * + * @return the networkInterfaceConfigurations value. + */ + public List networkInterfaceConfigurations() { + return this.networkInterfaceConfigurations; + } + + /** + * Set the networkInterfaceConfigurations property: The list of network configurations. + * + * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withNetworkInterfaceConfigurations( + List networkInterfaceConfigurations) { + this.networkInterfaceConfigurations = networkInterfaceConfigurations; + return this; + } + + /** + * Get the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set + * with orchestration mode 'Flexible'. + * + * @return the networkApiVersion value. + */ + public NetworkApiVersion networkApiVersion() { + return this.networkApiVersion; + } + + /** + * Set the networkApiVersion property: specifies the Microsoft.Network API version used when creating networking + * resources in the Network Interface Configurations for Virtual Machine Scale Set + * with orchestration mode 'Flexible'. + * + * @param networkApiVersion the networkApiVersion value to set. + * @return the VirtualMachineScaleSetNetworkProfile object itself. + */ + public VirtualMachineScaleSetNetworkProfile withNetworkApiVersion(NetworkApiVersion networkApiVersion) { + this.networkApiVersion = networkApiVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (healthProbe() != null) { + healthProbe().validate(); + } + if (networkInterfaceConfigurations() != null) { + networkInterfaceConfigurations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("healthProbe", this.healthProbe); + jsonWriter.writeArrayField("networkInterfaceConfigurations", this.networkInterfaceConfigurations, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("networkApiVersion", + this.networkApiVersion == null ? null : this.networkApiVersion.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetNetworkProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetNetworkProfile 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 VirtualMachineScaleSetNetworkProfile. + */ + public static VirtualMachineScaleSetNetworkProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetNetworkProfile deserializedVirtualMachineScaleSetNetworkProfile + = new VirtualMachineScaleSetNetworkProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("healthProbe".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkProfile.healthProbe = ApiEntityReference.fromJson(reader); + } else if ("networkInterfaceConfigurations".equals(fieldName)) { + List networkInterfaceConfigurations + = reader.readArray(reader1 -> VirtualMachineScaleSetNetworkConfiguration.fromJson(reader1)); + deserializedVirtualMachineScaleSetNetworkProfile.networkInterfaceConfigurations + = networkInterfaceConfigurations; + } else if ("networkApiVersion".equals(fieldName)) { + deserializedVirtualMachineScaleSetNetworkProfile.networkApiVersion + = NetworkApiVersion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetNetworkProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSDisk.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSDisk.java new file mode 100644 index 0000000000000..94c3111d6183c --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSDisk.java @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; +import java.util.List; + +/** + * Describes a virtual machine scale set operating system disk. + */ +@Fluent +public final class VirtualMachineScaleSetOSDisk implements JsonSerializable { + /* + * The disk name. + */ + private String name; + + /* + * Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.** + */ + private CachingTypes caching; + + /* + * Specifies whether writeAccelerator should be enabled or disabled on the disk. + */ + private Boolean writeAcceleratorEnabled; + + /* + * Specifies how the virtual machines in the scale set should be created. The only + * allowed value is: **FromImage.** This value is used when you are using an image + * to create the virtual machine. If you are using a platform image, you also use + * the imageReference element described above. If you are using a marketplace + * image, you also use the plan element previously described. + */ + private DiskCreateOptionTypes createOption; + + /* + * Specifies the ephemeral disk Settings for the operating system disk used by the + * virtual machine scale set. + */ + private DiffDiskSettings diffDiskSettings; + + /* + * Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' + * is the number of bytes x 1024^3 for the disk and the value cannot + * be larger than 1023. + */ + private Integer diskSizeGB; + + /* + * This property allows you to specify the type of the OS that is included in the + * disk if creating a VM from user-image or a specialized VHD. Possible values + * are: **Windows,** **Linux.** + */ + private OperatingSystemTypes osType; + + /* + * Specifies information about the unmanaged user image to base the scale set on. + */ + private VirtualHardDisk image; + + /* + * Specifies the container urls that are used to store operating system disks for + * the scale set. + */ + private List vhdContainers; + + /* + * The managed disk parameters. + */ + private VirtualMachineScaleSetManagedDiskParameters managedDisk; + + /* + * Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion + * (This feature is available for VMSS with Flexible OrchestrationMode only). + *

Possible values:

**Delete** If this value is used, the OS + * disk is deleted when VMSS Flex VM is deleted.

**Detach** If this value + * is used, the OS disk is retained after VMSS Flex VM is deleted.

The + * default value is set to **Delete**. For an Ephemeral OS Disk, the default value + * is set to **Delete**. User cannot change the delete option for Ephemeral OS + * Disk. + */ + private DiskDeleteOptionTypes deleteOption; + + /** + * Creates an instance of VirtualMachineScaleSetOSDisk class. + */ + public VirtualMachineScaleSetOSDisk() { + } + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the caching property: Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.**. + * + * @return the caching value. + */ + public CachingTypes caching() { + return this.caching; + } + + /** + * Set the caching property: Specifies the caching requirements. Possible values are: **None,** + * **ReadOnly,** **ReadWrite.** The default values are: **None for Standard + * storage. ReadOnly for Premium storage.**. + * + * @param caching the caching value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withCaching(CachingTypes caching) { + this.caching = caching; + return this; + } + + /** + * Get the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @return the writeAcceleratorEnabled value. + */ + public Boolean writeAcceleratorEnabled() { + return this.writeAcceleratorEnabled; + } + + /** + * Set the writeAcceleratorEnabled property: Specifies whether writeAccelerator should be enabled or disabled on the + * disk. + * + * @param writeAcceleratorEnabled the writeAcceleratorEnabled value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withWriteAcceleratorEnabled(Boolean writeAcceleratorEnabled) { + this.writeAcceleratorEnabled = writeAcceleratorEnabled; + return this; + } + + /** + * Get the createOption property: Specifies how the virtual machines in the scale set should be created. The only + * allowed value is: **FromImage.** This value is used when you are using an image + * to create the virtual machine. If you are using a platform image, you also use + * the imageReference element described above. If you are using a marketplace + * image, you also use the plan element previously described. + * + * @return the createOption value. + */ + public DiskCreateOptionTypes createOption() { + return this.createOption; + } + + /** + * Set the createOption property: Specifies how the virtual machines in the scale set should be created. The only + * allowed value is: **FromImage.** This value is used when you are using an image + * to create the virtual machine. If you are using a platform image, you also use + * the imageReference element described above. If you are using a marketplace + * image, you also use the plan element previously described. + * + * @param createOption the createOption value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withCreateOption(DiskCreateOptionTypes createOption) { + this.createOption = createOption; + return this; + } + + /** + * Get the diffDiskSettings property: Specifies the ephemeral disk Settings for the operating system disk used by + * the + * virtual machine scale set. + * + * @return the diffDiskSettings value. + */ + public DiffDiskSettings diffDiskSettings() { + return this.diffDiskSettings; + } + + /** + * Set the diffDiskSettings property: Specifies the ephemeral disk Settings for the operating system disk used by + * the + * virtual machine scale set. + * + * @param diffDiskSettings the diffDiskSettings value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withDiffDiskSettings(DiffDiskSettings diffDiskSettings) { + this.diffDiskSettings = diffDiskSettings; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' + * is the number of bytes x 1024^3 for the disk and the value cannot + * be larger than 1023. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. This element can be used + * to overwrite the size of the disk in a virtual machine image. The property 'diskSizeGB' + * is the number of bytes x 1024^3 for the disk and the value cannot + * be larger than 1023. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the + * disk if creating a VM from user-image or a specialized VHD. Possible values + * are: **Windows,** **Linux.**. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the + * disk if creating a VM from user-image or a specialized VHD. Possible values + * are: **Windows,** **Linux.**. + * + * @param osType the osType value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the image property: Specifies information about the unmanaged user image to base the scale set on. + * + * @return the image value. + */ + public VirtualHardDisk image() { + return this.image; + } + + /** + * Set the image property: Specifies information about the unmanaged user image to base the scale set on. + * + * @param image the image value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withImage(VirtualHardDisk image) { + this.image = image; + return this; + } + + /** + * Get the vhdContainers property: Specifies the container urls that are used to store operating system disks for + * the scale set. + * + * @return the vhdContainers value. + */ + public List vhdContainers() { + return this.vhdContainers; + } + + /** + * Set the vhdContainers property: Specifies the container urls that are used to store operating system disks for + * the scale set. + * + * @param vhdContainers the vhdContainers value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withVhdContainers(List vhdContainers) { + this.vhdContainers = vhdContainers; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineScaleSetManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withManagedDisk(VirtualMachineScaleSetManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Get the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion + * (This feature is available for VMSS with Flexible OrchestrationMode only). + * <br><br> Possible values: <br><br> **Delete** If this value is used, the OS + * disk is deleted when VMSS Flex VM is deleted.<br><br> **Detach** If this value + * is used, the OS disk is retained after VMSS Flex VM is deleted. <br><br> The + * default value is set to **Delete**. For an Ephemeral OS Disk, the default value + * is set to **Delete**. User cannot change the delete option for Ephemeral OS + * Disk. + * + * @return the deleteOption value. + */ + public DiskDeleteOptionTypes deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specifies whether OS Disk should be deleted or detached upon VMSS Flex deletion + * (This feature is available for VMSS with Flexible OrchestrationMode only). + * <br><br> Possible values: <br><br> **Delete** If this value is used, the OS + * disk is deleted when VMSS Flex VM is deleted.<br><br> **Detach** If this value + * is used, the OS disk is retained after VMSS Flex VM is deleted. <br><br> The + * default value is set to **Delete**. For an Ephemeral OS Disk, the default value + * is set to **Delete**. User cannot change the delete option for Ephemeral OS + * Disk. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetOSDisk object itself. + */ + public VirtualMachineScaleSetOSDisk withDeleteOption(DiskDeleteOptionTypes deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (createOption() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property createOption in model VirtualMachineScaleSetOSDisk")); + } + if (diffDiskSettings() != null) { + diffDiskSettings().validate(); + } + if (image() != null) { + image().validate(); + } + if (managedDisk() != null) { + managedDisk().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineScaleSetOSDisk.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createOption", this.createOption == null ? null : this.createOption.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("caching", this.caching == null ? null : this.caching.toString()); + jsonWriter.writeBooleanField("writeAcceleratorEnabled", this.writeAcceleratorEnabled); + jsonWriter.writeJsonField("diffDiskSettings", this.diffDiskSettings); + jsonWriter.writeNumberField("diskSizeGB", this.diskSizeGB); + jsonWriter.writeStringField("osType", this.osType == null ? null : this.osType.toString()); + jsonWriter.writeJsonField("image", this.image); + jsonWriter.writeArrayField("vhdContainers", this.vhdContainers, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("managedDisk", this.managedDisk); + jsonWriter.writeStringField("deleteOption", this.deleteOption == null ? null : this.deleteOption.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetOSDisk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetOSDisk 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 VirtualMachineScaleSetOSDisk. + */ + public static VirtualMachineScaleSetOSDisk fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetOSDisk deserializedVirtualMachineScaleSetOSDisk = new VirtualMachineScaleSetOSDisk(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("createOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.createOption + = DiskCreateOptionTypes.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.name = reader.getString(); + } else if ("caching".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.caching = CachingTypes.fromString(reader.getString()); + } else if ("writeAcceleratorEnabled".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.writeAcceleratorEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("diffDiskSettings".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.diffDiskSettings = DiffDiskSettings.fromJson(reader); + } else if ("diskSizeGB".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.diskSizeGB = reader.getNullable(JsonReader::getInt); + } else if ("osType".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.osType + = OperatingSystemTypes.fromString(reader.getString()); + } else if ("image".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.image = VirtualHardDisk.fromJson(reader); + } else if ("vhdContainers".equals(fieldName)) { + List vhdContainers = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualMachineScaleSetOSDisk.vhdContainers = vhdContainers; + } else if ("managedDisk".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.managedDisk + = VirtualMachineScaleSetManagedDiskParameters.fromJson(reader); + } else if ("deleteOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSDisk.deleteOption + = DiskDeleteOptionTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetOSDisk; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSProfile.java new file mode 100644 index 0000000000000..a5113e1cf0a18 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetOSProfile.java @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set OS profile. + */ +@Fluent +public final class VirtualMachineScaleSetOSProfile implements JsonSerializable { + /* + * Specifies the computer name prefix for all of the virtual machines in the scale + * set. Computer name prefixes must be 1 to 15 characters long. + */ + private String computerNamePrefix; + + /* + * Specifies the name of the administrator account.

**Windows-only + * restriction:** Cannot end in "."

**Disallowed values:** + * "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", + * "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", + * "console", "david", "guest", "john", "owner", "root", "server", "sql", + * "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + *

**Minimum-length (Linux):** 1 character

**Max-length + * (Linux):** 64 characters

**Max-length (Windows):** 20 characters + */ + private String adminUsername; + + /* + * Specifies the password of the administrator account.

**Minimum-length + * (Windows):** 8 characters

**Minimum-length (Linux):** 6 characters + *

**Max-length (Windows):** 123 characters

**Max-length + * (Linux):** 72 characters

**Complexity requirements:** 3 out of 4 + * conditions below need to be fulfilled
Has lower characters
Has upper + * characters
Has a digit
Has a special character (Regex match [\W_]) + *

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", + * "Password22", "iloveyou!"

For resetting the password, see [How to + * reset the Remote Desktop service or its login password in a Windows + * VM](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + *

For resetting root password, see [Manage users, SSH, and check or + * repair disks on Azure Linux VMs using the VMAccess + * Extension](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) + */ + private String adminPassword; + + /* + * Specifies a base-64 encoded string of custom data. The base-64 encoded string + * is decoded to a binary array that is saved as a file on the Virtual Machine. + * The maximum length of the binary array is 65535 bytes. For using cloud-init for + * your VM, see [Using cloud-init to customize a Linux VM during + * creation](https://learn.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + */ + private String customData; + + /* + * Specifies Windows operating system settings on the virtual machine. + */ + private WindowsConfiguration windowsConfiguration; + + /* + * Specifies the Linux operating system settings on the virtual machine. For a + * list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + */ + private LinuxConfiguration linuxConfiguration; + + /* + * Specifies set of certificates that should be installed onto the virtual + * machines in the scale set. To install certificates on a virtual machine it is + * recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + private List secrets; + + /* + * Specifies whether extension operations should be allowed on the virtual machine + * scale set. This may only be set to False when no extensions are present on the + * virtual machine scale set. + */ + private Boolean allowExtensionOperations; + + /* + * Optional property which must either be set to True or omitted. + */ + private Boolean requireGuestProvisionSignal; + + /** + * Creates an instance of VirtualMachineScaleSetOSProfile class. + */ + public VirtualMachineScaleSetOSProfile() { + } + + /** + * Get the computerNamePrefix property: Specifies the computer name prefix for all of the virtual machines in the + * scale + * set. Computer name prefixes must be 1 to 15 characters long. + * + * @return the computerNamePrefix value. + */ + public String computerNamePrefix() { + return this.computerNamePrefix; + } + + /** + * Set the computerNamePrefix property: Specifies the computer name prefix for all of the virtual machines in the + * scale + * set. Computer name prefixes must be 1 to 15 characters long. + * + * @param computerNamePrefix the computerNamePrefix value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withComputerNamePrefix(String computerNamePrefix) { + this.computerNamePrefix = computerNamePrefix; + return this; + } + + /** + * Get the adminUsername property: Specifies the name of the administrator account. <br><br> + * **Windows-only + * restriction:** Cannot end in "." <br><br> **Disallowed values:** + * "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", + * "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", + * "console", "david", "guest", "john", "owner", "root", "server", "sql", + * "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + * <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length + * (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. + * + * @return the adminUsername value. + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the adminUsername property: Specifies the name of the administrator account. <br><br> + * **Windows-only + * restriction:** Cannot end in "." <br><br> **Disallowed values:** + * "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", + * "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", + * "console", "david", "guest", "john", "owner", "root", "server", "sql", + * "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + * <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length + * (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters. + * + * @param adminUsername the adminUsername value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length + * (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length + * (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 + * conditions below need to be fulfilled <br> Has lower characters <br>Has upper + * characters <br> Has a digit <br> Has a special character (Regex match [\W_]) + * <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", + * "Password22", "iloveyou!" <br><br> For resetting the password, see [How to + * reset the Remote Desktop service or its login password in a Windows + * VM](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + * <br><br> For resetting root password, see [Manage users, SSH, and check or + * repair disks on Azure Linux VMs using the VMAccess + * Extension](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: Specifies the password of the administrator account. <br><br> + * **Minimum-length + * (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters + * <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length + * (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 + * conditions below need to be fulfilled <br> Has lower characters <br>Has upper + * characters <br> Has a digit <br> Has a special character (Regex match [\W_]) + * <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", + * "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", + * "Password22", "iloveyou!" <br><br> For resetting the password, see [How to + * reset the Remote Desktop service or its login password in a Windows + * VM](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/reset-rdp) + * <br><br> For resetting root password, see [Manage users, SSH, and check or + * repair disks on Azure Linux VMs using the VMAccess + * Extension](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection). + * + * @param adminPassword the adminPassword value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string + * is decoded to a binary array that is saved as a file on the Virtual Machine. + * The maximum length of the binary array is 65535 bytes. For using cloud-init for + * your VM, see [Using cloud-init to customize a Linux VM during + * creation](https://learn.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @return the customData value. + */ + public String customData() { + return this.customData; + } + + /** + * Set the customData property: Specifies a base-64 encoded string of custom data. The base-64 encoded string + * is decoded to a binary array that is saved as a file on the Virtual Machine. + * The maximum length of the binary array is 65535 bytes. For using cloud-init for + * your VM, see [Using cloud-init to customize a Linux VM during + * creation](https://learn.microsoft.com/azure/virtual-machines/linux/using-cloud-init). + * + * @param customData the customData value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withCustomData(String customData) { + this.customData = customData; + return this; + } + + /** + * Get the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @return the windowsConfiguration value. + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Specifies Windows operating system settings on the virtual machine. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. For a + * list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @return the linuxConfiguration value. + */ + public LinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: Specifies the Linux operating system settings on the virtual machine. For a + * list of supported Linux distributions, see [Linux on Azure-Endorsed + * Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withLinuxConfiguration(LinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the secrets property: Specifies set of certificates that should be installed onto the virtual + * machines in the scale set. To install certificates on a virtual machine it is + * recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the secrets value. + */ + public List secrets() { + return this.secrets; + } + + /** + * Set the secrets property: Specifies set of certificates that should be installed onto the virtual + * machines in the scale set. To install certificates on a virtual machine it is + * recommended to use the [Azure Key Vault virtual machine extension for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param secrets the secrets value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withSecrets(List secrets) { + this.secrets = secrets; + return this; + } + + /** + * Get the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine + * scale set. This may only be set to False when no extensions are present on the + * virtual machine scale set. + * + * @return the allowExtensionOperations value. + */ + public Boolean allowExtensionOperations() { + return this.allowExtensionOperations; + } + + /** + * Set the allowExtensionOperations property: Specifies whether extension operations should be allowed on the + * virtual machine + * scale set. This may only be set to False when no extensions are present on the + * virtual machine scale set. + * + * @param allowExtensionOperations the allowExtensionOperations value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withAllowExtensionOperations(Boolean allowExtensionOperations) { + this.allowExtensionOperations = allowExtensionOperations; + return this; + } + + /** + * Get the requireGuestProvisionSignal property: Optional property which must either be set to True or omitted. + * + * @return the requireGuestProvisionSignal value. + */ + public Boolean requireGuestProvisionSignal() { + return this.requireGuestProvisionSignal; + } + + /** + * Set the requireGuestProvisionSignal property: Optional property which must either be set to True or omitted. + * + * @param requireGuestProvisionSignal the requireGuestProvisionSignal value to set. + * @return the VirtualMachineScaleSetOSProfile object itself. + */ + public VirtualMachineScaleSetOSProfile withRequireGuestProvisionSignal(Boolean requireGuestProvisionSignal) { + this.requireGuestProvisionSignal = requireGuestProvisionSignal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (secrets() != null) { + secrets().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computerNamePrefix", this.computerNamePrefix); + jsonWriter.writeStringField("adminUsername", this.adminUsername); + jsonWriter.writeStringField("adminPassword", this.adminPassword); + jsonWriter.writeStringField("customData", this.customData); + jsonWriter.writeJsonField("windowsConfiguration", this.windowsConfiguration); + jsonWriter.writeJsonField("linuxConfiguration", this.linuxConfiguration); + jsonWriter.writeArrayField("secrets", this.secrets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("allowExtensionOperations", this.allowExtensionOperations); + jsonWriter.writeBooleanField("requireGuestProvisionSignal", this.requireGuestProvisionSignal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetOSProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetOSProfile 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 VirtualMachineScaleSetOSProfile. + */ + public static VirtualMachineScaleSetOSProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetOSProfile deserializedVirtualMachineScaleSetOSProfile + = new VirtualMachineScaleSetOSProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computerNamePrefix".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.computerNamePrefix = reader.getString(); + } else if ("adminUsername".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.adminUsername = reader.getString(); + } else if ("adminPassword".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.adminPassword = reader.getString(); + } else if ("customData".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.customData = reader.getString(); + } else if ("windowsConfiguration".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.windowsConfiguration + = WindowsConfiguration.fromJson(reader); + } else if ("linuxConfiguration".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.linuxConfiguration + = LinuxConfiguration.fromJson(reader); + } else if ("secrets".equals(fieldName)) { + List secrets = reader.readArray(reader1 -> VaultSecretGroup.fromJson(reader1)); + deserializedVirtualMachineScaleSetOSProfile.secrets = secrets; + } else if ("allowExtensionOperations".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.allowExtensionOperations + = reader.getNullable(JsonReader::getBoolean); + } else if ("requireGuestProvisionSignal".equals(fieldName)) { + deserializedVirtualMachineScaleSetOSProfile.requireGuestProvisionSignal + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetOSProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java new file mode 100644 index 0000000000000..cb312ef950b40 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfiguration.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfiguration + implements JsonSerializable { + /* + * The publicIP address configuration name. + */ + private String name; + + /* + * Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration + */ + private VirtualMachineScaleSetPublicIpAddressConfigurationProperties properties; + + /* + * Describes the public IP Sku. It can only be set with OrchestrationMode as + * Flexible. + */ + private PublicIpAddressSku sku; + + /** + * Creates an instance of VirtualMachineScaleSetPublicIpAddressConfiguration class. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration() { + } + + /** + * Get the name property: The publicIP address configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The publicIP address configuration name. + * + * @param name the name value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + * + * @return the properties value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + * + * @param properties the properties value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration + withProperties(VirtualMachineScaleSetPublicIpAddressConfigurationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as + * Flexible. + * + * @return the sku value. + */ + public PublicIpAddressSku sku() { + return this.sku; + } + + /** + * Set the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as + * Flexible. + * + * @param sku the sku value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfiguration object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfiguration withSku(PublicIpAddressSku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model VirtualMachineScaleSetPublicIpAddressConfiguration")); + } + if (properties() != null) { + properties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(VirtualMachineScaleSetPublicIpAddressConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetPublicIpAddressConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetPublicIpAddressConfiguration 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 VirtualMachineScaleSetPublicIpAddressConfiguration. + */ + public static VirtualMachineScaleSetPublicIpAddressConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetPublicIpAddressConfiguration deserializedVirtualMachineScaleSetPublicIpAddressConfiguration + = new VirtualMachineScaleSetPublicIpAddressConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfiguration.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfiguration.properties + = VirtualMachineScaleSetPublicIpAddressConfigurationProperties.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfiguration.sku + = PublicIpAddressSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetPublicIpAddressConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java new file mode 100644 index 0000000000000..fc1d1fd302bbe --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machines scale sets network configuration's DNS settings. + */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings + implements JsonSerializable { + /* + * The Domain name label.The concatenation of the domain name label and vm index + * will be the domain name labels of the PublicIPAddress resources that will be + * created + */ + private String domainNameLabel; + + /* + * The Domain name label scope.The concatenation of the hashed domain name label + * that generated according to the policy from domain name label scope and vm + * index will be the domain name labels of the PublicIPAddress resources that will + * be created + */ + private DomainNameLabelScopeTypes domainNameLabelScope; + + /** + * Creates an instance of VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings class. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() { + } + + /** + * Get the domainNameLabel property: The Domain name label.The concatenation of the domain name label and vm index + * will be the domain name labels of the PublicIPAddress resources that will be + * created. + * + * @return the domainNameLabel value. + */ + public String domainNameLabel() { + return this.domainNameLabel; + } + + /** + * Set the domainNameLabel property: The Domain name label.The concatenation of the domain name label and vm index + * will be the domain name labels of the PublicIPAddress resources that will be + * created. + * + * @param domainNameLabel the domainNameLabel value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings withDomainNameLabel(String domainNameLabel) { + this.domainNameLabel = domainNameLabel; + return this; + } + + /** + * Get the domainNameLabelScope property: The Domain name label scope.The concatenation of the hashed domain name + * label + * that generated according to the policy from domain name label scope and vm + * index will be the domain name labels of the PublicIPAddress resources that will + * be created. + * + * @return the domainNameLabelScope value. + */ + public DomainNameLabelScopeTypes domainNameLabelScope() { + return this.domainNameLabelScope; + } + + /** + * Set the domainNameLabelScope property: The Domain name label scope.The concatenation of the hashed domain name + * label + * that generated according to the policy from domain name label scope and vm + * index will be the domain name labels of the PublicIPAddress resources that will + * be created. + * + * @param domainNameLabelScope the domainNameLabelScope value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings + withDomainNameLabelScope(DomainNameLabelScopeTypes domainNameLabelScope) { + this.domainNameLabelScope = domainNameLabelScope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (domainNameLabel() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property domainNameLabel in model VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("domainNameLabel", this.domainNameLabel); + jsonWriter.writeStringField("domainNameLabelScope", + this.domainNameLabelScope == null ? null : this.domainNameLabelScope.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings 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 + * VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings. + */ + public static VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings deserializedVirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings + = new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domainNameLabel".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.domainNameLabel + = reader.getString(); + } else if ("domainNameLabelScope".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.domainNameLabelScope + = DomainNameLabelScopeTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java new file mode 100644 index 0000000000000..61da3cbbb1989 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetPublicIpAddressConfigurationProperties.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SubResource; +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; + +/** + * Describes a virtual machines scale set IP Configuration's PublicIPAddress + * configuration. + */ +@Fluent +public final class VirtualMachineScaleSetPublicIpAddressConfigurationProperties + implements JsonSerializable { + /* + * The idle timeout of the public IP address. + */ + private Integer idleTimeoutInMinutes; + + /* + * The dns settings to be applied on the publicIP addresses . + */ + private VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings; + + /* + * The list of IP tags associated with the public IP address. + */ + private List ipTags; + + /* + * The PublicIPPrefix from which to allocate publicIP addresses. + */ + private SubResource publicIpPrefix; + + /* + * Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + */ + private IpVersion publicIpAddressVersion; + + /* + * Specify what happens to the public IP when the VM is deleted + */ + private DeleteOptions deleteOption; + + /** + * Creates an instance of VirtualMachineScaleSetPublicIpAddressConfigurationProperties class. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties() { + } + + /** + * Get the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @return the idleTimeoutInMinutes value. + */ + public Integer idleTimeoutInMinutes() { + return this.idleTimeoutInMinutes; + } + + /** + * Set the idleTimeoutInMinutes property: The idle timeout of the public IP address. + * + * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties + withIdleTimeoutInMinutes(Integer idleTimeoutInMinutes) { + this.idleTimeoutInMinutes = idleTimeoutInMinutes; + return this; + } + + /** + * Get the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @return the dnsSettings value. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: The dns settings to be applied on the publicIP addresses . + * + * @param dnsSettings the dnsSettings value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties + withDnsSettings(VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the ipTags property: The list of IP tags associated with the public IP address. + * + * @return the ipTags value. + */ + public List ipTags() { + return this.ipTags; + } + + /** + * Set the ipTags property: The list of IP tags associated with the public IP address. + * + * @param ipTags the ipTags value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties + withIpTags(List ipTags) { + this.ipTags = ipTags; + return this; + } + + /** + * Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @return the publicIpPrefix value. + */ + public SubResource publicIpPrefix() { + return this.publicIpPrefix; + } + + /** + * Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses. + * + * @param publicIpPrefix the publicIpPrefix value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withPublicIpPrefix(SubResource publicIpPrefix) { + this.publicIpPrefix = publicIpPrefix; + return this; + } + + /** + * Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + * + * @return the publicIpAddressVersion value. + */ + public IpVersion publicIpAddressVersion() { + return this.publicIpAddressVersion; + } + + /** + * Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. + * + * @param publicIpAddressVersion the publicIpAddressVersion value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties + withPublicIpAddressVersion(IpVersion publicIpAddressVersion) { + this.publicIpAddressVersion = publicIpAddressVersion; + return this; + } + + /** + * Get the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @return the deleteOption value. + */ + public DeleteOptions deleteOption() { + return this.deleteOption; + } + + /** + * Set the deleteOption property: Specify what happens to the public IP when the VM is deleted. + * + * @param deleteOption the deleteOption value to set. + * @return the VirtualMachineScaleSetPublicIpAddressConfigurationProperties object itself. + */ + public VirtualMachineScaleSetPublicIpAddressConfigurationProperties withDeleteOption(DeleteOptions deleteOption) { + this.deleteOption = deleteOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (ipTags() != null) { + ipTags().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("idleTimeoutInMinutes", this.idleTimeoutInMinutes); + jsonWriter.writeJsonField("dnsSettings", this.dnsSettings); + jsonWriter.writeArrayField("ipTags", this.ipTags, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("publicIPPrefix", this.publicIpPrefix); + jsonWriter.writeStringField("publicIPAddressVersion", + this.publicIpAddressVersion == null ? null : this.publicIpAddressVersion.toString()); + jsonWriter.writeStringField("deleteOption", this.deleteOption == null ? null : this.deleteOption.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetPublicIpAddressConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetPublicIpAddressConfigurationProperties 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 + * VirtualMachineScaleSetPublicIpAddressConfigurationProperties. + */ + public static VirtualMachineScaleSetPublicIpAddressConfigurationProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetPublicIpAddressConfigurationProperties deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties + = new VirtualMachineScaleSetPublicIpAddressConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("idleTimeoutInMinutes".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.idleTimeoutInMinutes + = reader.getNullable(JsonReader::getInt); + } else if ("dnsSettings".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.dnsSettings + = VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings.fromJson(reader); + } else if ("ipTags".equals(fieldName)) { + List ipTags + = reader.readArray(reader1 -> VirtualMachineScaleSetIpTag.fromJson(reader1)); + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.ipTags = ipTags; + } else if ("publicIPPrefix".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.publicIpPrefix + = SubResource.fromJson(reader); + } else if ("publicIPAddressVersion".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.publicIpAddressVersion + = IpVersion.fromString(reader.getString()); + } else if ("deleteOption".equals(fieldName)) { + deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties.deleteOption + = DeleteOptions.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetPublicIpAddressConfigurationProperties; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetStorageProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetStorageProfile.java new file mode 100644 index 0000000000000..1cad2e090059e --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VirtualMachineScaleSetStorageProfile.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes a virtual machine scale set storage profile. + */ +@Fluent +public final class VirtualMachineScaleSetStorageProfile + implements JsonSerializable { + /* + * Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is + * required when you want to use a platform image, marketplace image, or virtual + * machine image, but is not used in other creation operations. + */ + private ImageReference imageReference; + + /* + * Specifies information about the operating system disk used by the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + private VirtualMachineScaleSetOSDisk osDisk; + + /* + * Specifies the parameters that are used to add data disks to the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + */ + private List dataDisks; + + /* + * Specifies the disk controller type configured for the virtual machines in the scale set. Minimum api-version: + * 2022-08-01 + */ + private DiskControllerTypes diskControllerType; + + /** + * Creates an instance of VirtualMachineScaleSetStorageProfile class. + */ + public VirtualMachineScaleSetStorageProfile() { + } + + /** + * Get the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is + * required when you want to use a platform image, marketplace image, or virtual + * machine image, but is not used in other creation operations. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Specifies information about the image to use. You can specify information about + * platform images, marketplace images, or virtual machine images. This element is + * required when you want to use a platform image, marketplace image, or virtual + * machine image, but is not used in other creation operations. + * + * @param imageReference the imageReference value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the osDisk property: Specifies information about the operating system disk used by the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the osDisk value. + */ + public VirtualMachineScaleSetOSDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: Specifies information about the operating system disk used by the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param osDisk the osDisk value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withOsDisk(VirtualMachineScaleSetOSDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the dataDisks property: Specifies the parameters that are used to add data disks to the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Specifies the parameters that are used to add data disks to the virtual + * machines in the scale set. For more information about disks, see [About disks + * and VHDs for Azure virtual + * machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). + * + * @param dataDisks the dataDisks value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Get the diskControllerType property: Specifies the disk controller type configured for the virtual machines in + * the scale set. Minimum api-version: 2022-08-01. + * + * @return the diskControllerType value. + */ + public DiskControllerTypes diskControllerType() { + return this.diskControllerType; + } + + /** + * Set the diskControllerType property: Specifies the disk controller type configured for the virtual machines in + * the scale set. Minimum api-version: 2022-08-01. + * + * @param diskControllerType the diskControllerType value to set. + * @return the VirtualMachineScaleSetStorageProfile object itself. + */ + public VirtualMachineScaleSetStorageProfile withDiskControllerType(DiskControllerTypes diskControllerType) { + this.diskControllerType = diskControllerType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + if (osDisk() != null) { + osDisk().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("imageReference", this.imageReference); + jsonWriter.writeJsonField("osDisk", this.osDisk); + jsonWriter.writeArrayField("dataDisks", this.dataDisks, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("diskControllerType", + this.diskControllerType == null ? null : this.diskControllerType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineScaleSetStorageProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineScaleSetStorageProfile 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 VirtualMachineScaleSetStorageProfile. + */ + public static VirtualMachineScaleSetStorageProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineScaleSetStorageProfile deserializedVirtualMachineScaleSetStorageProfile + = new VirtualMachineScaleSetStorageProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("imageReference".equals(fieldName)) { + deserializedVirtualMachineScaleSetStorageProfile.imageReference = ImageReference.fromJson(reader); + } else if ("osDisk".equals(fieldName)) { + deserializedVirtualMachineScaleSetStorageProfile.osDisk + = VirtualMachineScaleSetOSDisk.fromJson(reader); + } else if ("dataDisks".equals(fieldName)) { + List dataDisks + = reader.readArray(reader1 -> VirtualMachineScaleSetDataDisk.fromJson(reader1)); + deserializedVirtualMachineScaleSetStorageProfile.dataDisks = dataDisks; + } else if ("diskControllerType".equals(fieldName)) { + deserializedVirtualMachineScaleSetStorageProfile.diskControllerType + = DiskControllerTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineScaleSetStorageProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VmSizeProfile.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VmSizeProfile.java new file mode 100644 index 0000000000000..ce05db1670e2d --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/VmSizeProfile.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifications about a VM Size. This will also contain the corresponding rank and weight in future. + */ +@Fluent +public final class VmSizeProfile implements JsonSerializable { + /* + * The Sku name (e.g. 'Standard_DS1_v2') + */ + private String name; + + /* + * The rank of the VM size. This is used with 'RegularPriorityAllocationStrategy.Prioritized' + * The lower the number, the higher the priority. Starting with 0. + */ + private Integer rank; + + /** + * Creates an instance of VmSizeProfile class. + */ + public VmSizeProfile() { + } + + /** + * Get the name property: The Sku name (e.g. 'Standard_DS1_v2'). + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The Sku name (e.g. 'Standard_DS1_v2'). + * + * @param name the name value to set. + * @return the VmSizeProfile object itself. + */ + public VmSizeProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get the rank property: The rank of the VM size. This is used with 'RegularPriorityAllocationStrategy.Prioritized' + * The lower the number, the higher the priority. Starting with 0. + * + * @return the rank value. + */ + public Integer rank() { + return this.rank; + } + + /** + * Set the rank property: The rank of the VM size. This is used with 'RegularPriorityAllocationStrategy.Prioritized' + * The lower the number, the higher the priority. Starting with 0. + * + * @param rank the rank value to set. + * @return the VmSizeProfile object itself. + */ + public VmSizeProfile withRank(Integer rank) { + this.rank = rank; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model VmSizeProfile")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VmSizeProfile.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeNumberField("rank", this.rank); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmSizeProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmSizeProfile 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 VmSizeProfile. + */ + public static VmSizeProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmSizeProfile deserializedVmSizeProfile = new VmSizeProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedVmSizeProfile.name = reader.getString(); + } else if ("rank".equals(fieldName)) { + deserializedVmSizeProfile.rank = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVmSizeProfile; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMConfiguration.java new file mode 100644 index 0000000000000..81a94bbc36cf4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes Windows Remote Management configuration of the VM. + */ +@Fluent +public final class WinRMConfiguration implements JsonSerializable { + /* + * The list of Windows Remote Management listeners + */ + private List listeners; + + /** + * Creates an instance of WinRMConfiguration class. + */ + public WinRMConfiguration() { + } + + /** + * Get the listeners property: The list of Windows Remote Management listeners. + * + * @return the listeners value. + */ + public List listeners() { + return this.listeners; + } + + /** + * Set the listeners property: The list of Windows Remote Management listeners. + * + * @param listeners the listeners value to set. + * @return the WinRMConfiguration object itself. + */ + public WinRMConfiguration withListeners(List listeners) { + this.listeners = listeners; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (listeners() != null) { + listeners().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("listeners", this.listeners, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WinRMConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WinRMConfiguration 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 WinRMConfiguration. + */ + public static WinRMConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WinRMConfiguration deserializedWinRMConfiguration = new WinRMConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("listeners".equals(fieldName)) { + List listeners = reader.readArray(reader1 -> WinRMListener.fromJson(reader1)); + deserializedWinRMConfiguration.listeners = listeners; + } else { + reader.skipChildren(); + } + } + + return deserializedWinRMConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMListener.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMListener.java new file mode 100644 index 0000000000000..21d78dfec330a --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WinRMListener.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Describes Protocol and thumbprint of Windows Remote Management listener. + */ +@Fluent +public final class WinRMListener implements JsonSerializable { + /* + * Specifies the protocol of WinRM listener. Possible values are: **http,** + * **https.** + */ + private ProtocolTypes protocol; + + /* + * This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be the Base64 encoding of the following + * JSON Object which is encoded in UTF-8:

{
+ * "data":"",
"dataType":"pfx",
+ * "password":""
}
To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + */ + private String certificateUrl; + + /** + * Creates an instance of WinRMListener class. + */ + public WinRMListener() { + } + + /** + * Get the protocol property: Specifies the protocol of WinRM listener. Possible values are: **http,** + * **https.**. + * + * @return the protocol value. + */ + public ProtocolTypes protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Specifies the protocol of WinRM listener. Possible values are: **http,** + * **https.**. + * + * @param protocol the protocol value to set. + * @return the WinRMListener object itself. + */ + public WinRMListener withProtocol(ProtocolTypes protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be the Base64 encoding of the following + * JSON Object which is encoded in UTF-8: <br><br> {<br> + * "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> + * "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @return the certificateUrl value. + */ + public String certificateUrl() { + return this.certificateUrl; + } + + /** + * Set the certificateUrl property: This is the URL of a certificate that has been uploaded to Key Vault as a + * secret. For adding a secret to the Key Vault, see [Add a key or secret to the + * key + * vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). + * In this case, your certificate needs to be the Base64 encoding of the following + * JSON Object which is encoded in UTF-8: <br><br> {<br> + * "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> + * "password":"<pfx-file-password>"<br>} <br> To install certificates on a virtual + * machine it is recommended to use the [Azure Key Vault virtual machine extension + * for + * Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + * or the [Azure Key Vault virtual machine extension for + * Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + * + * @param certificateUrl the certificateUrl value to set. + * @return the WinRMListener object itself. + */ + public WinRMListener withCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + 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("protocol", this.protocol == null ? null : this.protocol.toString()); + jsonWriter.writeStringField("certificateUrl", this.certificateUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WinRMListener from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WinRMListener 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 WinRMListener. + */ + public static WinRMListener fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WinRMListener deserializedWinRMListener = new WinRMListener(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protocol".equals(fieldName)) { + deserializedWinRMListener.protocol = ProtocolTypes.fromString(reader.getString()); + } else if ("certificateUrl".equals(fieldName)) { + deserializedWinRMListener.certificateUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWinRMListener; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsConfiguration.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsConfiguration.java new file mode 100644 index 0000000000000..21fdbb0cf7b17 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsConfiguration.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies Windows operating system settings on the virtual machine. + */ +@Fluent +public final class WindowsConfiguration implements JsonSerializable { + /* + * Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, it is set to + * true by default. This will ensure that VM Agent is installed on the VM so that + * extensions can be added to the VM later. + */ + private Boolean provisionVMAgent; + + /* + * Indicates whether Automatic Updates is enabled for the Windows virtual machine. + * Default value is true. For virtual machine scale sets, this property can be + * updated and updates will take effect on OS reprovisioning. + */ + private Boolean enableAutomaticUpdates; + + /* + * Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + * Possible values can be + * [TimeZoneInfo.Id](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + * value from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + */ + private String timeZone; + + /* + * Specifies additional base-64 encoded XML formatted information that can be + * included in the Unattend.xml file, which is used by Windows Setup. + */ + private List additionalUnattendContent; + + /* + * [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + */ + private PatchSettings patchSettings; + + /* + * Specifies the Windows Remote Management listeners. This enables remote Windows + * PowerShell. + */ + private WinRMConfiguration winRM; + + /* + * Indicates whether VMAgent Platform Updates is enabled for the Windows virtual + * machine. Default value is false. + */ + private Boolean enableVMAgentPlatformUpdates; + + /** + * Creates an instance of WindowsConfiguration class. + */ + public WindowsConfiguration() { + } + + /** + * Get the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, it is set to + * true by default. This will ensure that VM Agent is installed on the VM so that + * extensions can be added to the VM later. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Indicates whether virtual machine agent should be provisioned on the virtual + * machine. When this property is not specified in the request body, it is set to + * true by default. This will ensure that VM Agent is installed on the VM so that + * extensions can be added to the VM later. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual + * machine. + * Default value is true. For virtual machine scale sets, this property can be + * updated and updates will take effect on OS reprovisioning. + * + * @return the enableAutomaticUpdates value. + */ + public Boolean enableAutomaticUpdates() { + return this.enableAutomaticUpdates; + } + + /** + * Set the enableAutomaticUpdates property: Indicates whether Automatic Updates is enabled for the Windows virtual + * machine. + * Default value is true. For virtual machine scale sets, this property can be + * updated and updates will take effect on OS reprovisioning. + * + * @param enableAutomaticUpdates the enableAutomaticUpdates value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { + this.enableAutomaticUpdates = enableAutomaticUpdates; + return this; + } + + /** + * Get the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + * Possible values can be + * [TimeZoneInfo.Id](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + * value from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + * Possible values can be + * [TimeZoneInfo.Id](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + * value from time zones returned by + * [TimeZoneInfo.GetSystemTimeZones](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + * + * @param timeZone the timeZone value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that + * can be + * included in the Unattend.xml file, which is used by Windows Setup. + * + * @return the additionalUnattendContent value. + */ + public List additionalUnattendContent() { + return this.additionalUnattendContent; + } + + /** + * Set the additionalUnattendContent property: Specifies additional base-64 encoded XML formatted information that + * can be + * included in the Unattend.xml file, which is used by Windows Setup. + * + * @param additionalUnattendContent the additionalUnattendContent value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration + withAdditionalUnattendContent(List additionalUnattendContent) { + this.additionalUnattendContent = additionalUnattendContent; + return this; + } + + /** + * Get the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + * + * @return the patchSettings value. + */ + public PatchSettings patchSettings() { + return this.patchSettings; + } + + /** + * Set the patchSettings property: [Preview Feature] Specifies settings related to VM Guest Patching on Windows. + * + * @param patchSettings the patchSettings value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withPatchSettings(PatchSettings patchSettings) { + this.patchSettings = patchSettings; + return this; + } + + /** + * Get the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows + * PowerShell. + * + * @return the winRM value. + */ + public WinRMConfiguration winRM() { + return this.winRM; + } + + /** + * Set the winRM property: Specifies the Windows Remote Management listeners. This enables remote Windows + * PowerShell. + * + * @param winRM the winRM value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withWinRM(WinRMConfiguration winRM) { + this.winRM = winRM; + return this; + } + + /** + * Get the enableVMAgentPlatformUpdates property: Indicates whether VMAgent Platform Updates is enabled for the + * Windows virtual + * machine. Default value is false. + * + * @return the enableVMAgentPlatformUpdates value. + */ + public Boolean enableVMAgentPlatformUpdates() { + return this.enableVMAgentPlatformUpdates; + } + + /** + * Set the enableVMAgentPlatformUpdates property: Indicates whether VMAgent Platform Updates is enabled for the + * Windows virtual + * machine. Default value is false. + * + * @param enableVMAgentPlatformUpdates the enableVMAgentPlatformUpdates value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withEnableVMAgentPlatformUpdates(Boolean enableVMAgentPlatformUpdates) { + this.enableVMAgentPlatformUpdates = enableVMAgentPlatformUpdates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (additionalUnattendContent() != null) { + additionalUnattendContent().forEach(e -> e.validate()); + } + if (patchSettings() != null) { + patchSettings().validate(); + } + if (winRM() != null) { + winRM().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeBooleanField("enableAutomaticUpdates", this.enableAutomaticUpdates); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeArrayField("additionalUnattendContent", this.additionalUnattendContent, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("patchSettings", this.patchSettings); + jsonWriter.writeJsonField("winRM", this.winRM); + jsonWriter.writeBooleanField("enableVMAgentPlatformUpdates", this.enableVMAgentPlatformUpdates); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WindowsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WindowsConfiguration 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 WindowsConfiguration. + */ + public static WindowsConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WindowsConfiguration deserializedWindowsConfiguration = new WindowsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisionVMAgent".equals(fieldName)) { + deserializedWindowsConfiguration.provisionVMAgent = reader.getNullable(JsonReader::getBoolean); + } else if ("enableAutomaticUpdates".equals(fieldName)) { + deserializedWindowsConfiguration.enableAutomaticUpdates + = reader.getNullable(JsonReader::getBoolean); + } else if ("timeZone".equals(fieldName)) { + deserializedWindowsConfiguration.timeZone = reader.getString(); + } else if ("additionalUnattendContent".equals(fieldName)) { + List additionalUnattendContent + = reader.readArray(reader1 -> AdditionalUnattendContent.fromJson(reader1)); + deserializedWindowsConfiguration.additionalUnattendContent = additionalUnattendContent; + } else if ("patchSettings".equals(fieldName)) { + deserializedWindowsConfiguration.patchSettings = PatchSettings.fromJson(reader); + } else if ("winRM".equals(fieldName)) { + deserializedWindowsConfiguration.winRM = WinRMConfiguration.fromJson(reader); + } else if ("enableVMAgentPlatformUpdates".equals(fieldName)) { + deserializedWindowsConfiguration.enableVMAgentPlatformUpdates + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedWindowsConfiguration; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsPatchAssessmentMode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsPatchAssessmentMode.java new file mode 100644 index 0000000000000..edcdda5561124 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsPatchAssessmentMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the mode of VM Guest patch assessment for the IaaS virtual machine. + */ +public final class WindowsPatchAssessmentMode extends ExpandableStringEnum { + /** + * Static value ImageDefault for WindowsPatchAssessmentMode. + */ + public static final WindowsPatchAssessmentMode IMAGE_DEFAULT = fromString("ImageDefault"); + + /** + * Static value AutomaticByPlatform for WindowsPatchAssessmentMode. + */ + public static final WindowsPatchAssessmentMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates a new instance of WindowsPatchAssessmentMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WindowsPatchAssessmentMode() { + } + + /** + * Creates or finds a WindowsPatchAssessmentMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsPatchAssessmentMode. + */ + public static WindowsPatchAssessmentMode fromString(String name) { + return fromString(name, WindowsPatchAssessmentMode.class); + } + + /** + * Gets known WindowsPatchAssessmentMode values. + * + * @return known WindowsPatchAssessmentMode values. + */ + public static Collection values() { + return values(WindowsPatchAssessmentMode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.java new file mode 100644 index 0000000000000..9891fd81b6541 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformRebootSetting.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + */ +public final class WindowsVMGuestPatchAutomaticByPlatformRebootSetting + extends ExpandableStringEnum { + /** + * Static value Unknown for WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final WindowsVMGuestPatchAutomaticByPlatformRebootSetting UNKNOWN = fromString("Unknown"); + + /** + * Static value IfRequired for WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final WindowsVMGuestPatchAutomaticByPlatformRebootSetting IF_REQUIRED = fromString("IfRequired"); + + /** + * Static value Never for WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final WindowsVMGuestPatchAutomaticByPlatformRebootSetting NEVER = fromString("Never"); + + /** + * Static value Always for WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static final WindowsVMGuestPatchAutomaticByPlatformRebootSetting ALWAYS = fromString("Always"); + + /** + * Creates a new instance of WindowsVMGuestPatchAutomaticByPlatformRebootSetting value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WindowsVMGuestPatchAutomaticByPlatformRebootSetting() { + } + + /** + * Creates or finds a WindowsVMGuestPatchAutomaticByPlatformRebootSetting from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsVMGuestPatchAutomaticByPlatformRebootSetting. + */ + public static WindowsVMGuestPatchAutomaticByPlatformRebootSetting fromString(String name) { + return fromString(name, WindowsVMGuestPatchAutomaticByPlatformRebootSetting.class); + } + + /** + * Gets known WindowsVMGuestPatchAutomaticByPlatformRebootSetting values. + * + * @return known WindowsVMGuestPatchAutomaticByPlatformRebootSetting values. + */ + public static Collection values() { + return values(WindowsVMGuestPatchAutomaticByPlatformRebootSetting.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformSettings.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformSettings.java new file mode 100644 index 0000000000000..83b4a674b81f6 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchAutomaticByPlatformSettings.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.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; + +/** + * Specifies additional settings to be applied when patch mode AutomaticByPlatform + * is selected in Windows patch settings. + */ +@Fluent +public final class WindowsVMGuestPatchAutomaticByPlatformSettings + implements JsonSerializable { + /* + * Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + */ + private WindowsVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting; + + /* + * Enables customer to schedule patching without accidental upgrades + */ + private Boolean bypassPlatformSafetyChecksOnUserSchedule; + + /** + * Creates an instance of WindowsVMGuestPatchAutomaticByPlatformSettings class. + */ + public WindowsVMGuestPatchAutomaticByPlatformSettings() { + } + + /** + * Get the rebootSetting property: Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + * + * @return the rebootSetting value. + */ + public WindowsVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting() { + return this.rebootSetting; + } + + /** + * Set the rebootSetting property: Specifies the reboot setting for all AutomaticByPlatform patch installation + * operations. + * + * @param rebootSetting the rebootSetting value to set. + * @return the WindowsVMGuestPatchAutomaticByPlatformSettings object itself. + */ + public WindowsVMGuestPatchAutomaticByPlatformSettings + withRebootSetting(WindowsVMGuestPatchAutomaticByPlatformRebootSetting rebootSetting) { + this.rebootSetting = rebootSetting; + return this; + } + + /** + * Get the bypassPlatformSafetyChecksOnUserSchedule property: Enables customer to schedule patching without + * accidental upgrades. + * + * @return the bypassPlatformSafetyChecksOnUserSchedule value. + */ + public Boolean bypassPlatformSafetyChecksOnUserSchedule() { + return this.bypassPlatformSafetyChecksOnUserSchedule; + } + + /** + * Set the bypassPlatformSafetyChecksOnUserSchedule property: Enables customer to schedule patching without + * accidental upgrades. + * + * @param bypassPlatformSafetyChecksOnUserSchedule the bypassPlatformSafetyChecksOnUserSchedule value to set. + * @return the WindowsVMGuestPatchAutomaticByPlatformSettings object itself. + */ + public WindowsVMGuestPatchAutomaticByPlatformSettings + withBypassPlatformSafetyChecksOnUserSchedule(Boolean bypassPlatformSafetyChecksOnUserSchedule) { + this.bypassPlatformSafetyChecksOnUserSchedule = bypassPlatformSafetyChecksOnUserSchedule; + 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("rebootSetting", this.rebootSetting == null ? null : this.rebootSetting.toString()); + jsonWriter.writeBooleanField("bypassPlatformSafetyChecksOnUserSchedule", + this.bypassPlatformSafetyChecksOnUserSchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WindowsVMGuestPatchAutomaticByPlatformSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WindowsVMGuestPatchAutomaticByPlatformSettings 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 WindowsVMGuestPatchAutomaticByPlatformSettings. + */ + public static WindowsVMGuestPatchAutomaticByPlatformSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WindowsVMGuestPatchAutomaticByPlatformSettings deserializedWindowsVMGuestPatchAutomaticByPlatformSettings + = new WindowsVMGuestPatchAutomaticByPlatformSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rebootSetting".equals(fieldName)) { + deserializedWindowsVMGuestPatchAutomaticByPlatformSettings.rebootSetting + = WindowsVMGuestPatchAutomaticByPlatformRebootSetting.fromString(reader.getString()); + } else if ("bypassPlatformSafetyChecksOnUserSchedule".equals(fieldName)) { + deserializedWindowsVMGuestPatchAutomaticByPlatformSettings.bypassPlatformSafetyChecksOnUserSchedule + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedWindowsVMGuestPatchAutomaticByPlatformSettings; + }); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchMode.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchMode.java new file mode 100644 index 0000000000000..e716f958d55d9 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/WindowsVMGuestPatchMode.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the mode of VM Guest Patching to IaaS virtual machine or virtual + * machines associated to virtual machine scale set with OrchestrationMode as + * Flexible. + */ +public final class WindowsVMGuestPatchMode extends ExpandableStringEnum { + /** + * Static value Manual for WindowsVMGuestPatchMode. + */ + public static final WindowsVMGuestPatchMode MANUAL = fromString("Manual"); + + /** + * Static value AutomaticByOS for WindowsVMGuestPatchMode. + */ + public static final WindowsVMGuestPatchMode AUTOMATIC_BY_OS = fromString("AutomaticByOS"); + + /** + * Static value AutomaticByPlatform for WindowsVMGuestPatchMode. + */ + public static final WindowsVMGuestPatchMode AUTOMATIC_BY_PLATFORM = fromString("AutomaticByPlatform"); + + /** + * Creates a new instance of WindowsVMGuestPatchMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public WindowsVMGuestPatchMode() { + } + + /** + * Creates or finds a WindowsVMGuestPatchMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsVMGuestPatchMode. + */ + public static WindowsVMGuestPatchMode fromString(String name) { + return fromString(name, WindowsVMGuestPatchMode.class); + } + + /** + * Gets known WindowsVMGuestPatchMode values. + * + * @return known WindowsVMGuestPatchMode values. + */ + public static Collection values() { + return values(WindowsVMGuestPatchMode.class); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/package-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/package-info.java new file mode 100644 index 0000000000000..f168cd4aa1453 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for MicrosoftAzureFleet. + * null. + */ +package com.azure.resourcemanager.azurefleet.models; diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/package-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/package-info.java new file mode 100644 index 0000000000000..b51cf43e1e94b --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/com/azure/resourcemanager/azurefleet/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for MicrosoftAzureFleet. + * null. + */ +package com.azure.resourcemanager.azurefleet; diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/module-info.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/module-info.java new file mode 100644 index 0000000000000..4c6eb044866e4 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.azurefleet { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.azurefleet; + exports com.azure.resourcemanager.azurefleet.fluent; + exports com.azure.resourcemanager.azurefleet.fluent.models; + exports com.azure.resourcemanager.azurefleet.models; + + opens com.azure.resourcemanager.azurefleet.fluent.models to com.azure.core; + opens com.azure.resourcemanager.azurefleet.models to com.azure.core; +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/proxy-config.json b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/proxy-config.json new file mode 100644 index 0000000000000..ee614e54c1799 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.azurefleet.implementation.FleetsClientImpl$FleetsService"],["com.azure.resourcemanager.azurefleet.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/reflect-config.json b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurefleet/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsCreateOrUpdateSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b43962e780bb1 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsCreateOrUpdateSamples.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContent; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentComponentName; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentPassName; +import com.azure.resourcemanager.azurefleet.models.ApiEntityReference; +import com.azure.resourcemanager.azurefleet.models.ApplicationProfile; +import com.azure.resourcemanager.azurefleet.models.BaseVirtualMachineProfile; +import com.azure.resourcemanager.azurefleet.models.BootDiagnostics; +import com.azure.resourcemanager.azurefleet.models.CachingTypes; +import com.azure.resourcemanager.azurefleet.models.CapacityReservationProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.DeleteOptions; +import com.azure.resourcemanager.azurefleet.models.DiagnosticsProfile; +import com.azure.resourcemanager.azurefleet.models.DiffDiskOptions; +import com.azure.resourcemanager.azurefleet.models.DiffDiskPlacement; +import com.azure.resourcemanager.azurefleet.models.DiffDiskSettings; +import com.azure.resourcemanager.azurefleet.models.DiskControllerTypes; +import com.azure.resourcemanager.azurefleet.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.azurefleet.models.DomainNameLabelScopeTypes; +import com.azure.resourcemanager.azurefleet.models.EncryptionIdentity; +import com.azure.resourcemanager.azurefleet.models.EvictionPolicy; +import com.azure.resourcemanager.azurefleet.models.ImageReference; +import com.azure.resourcemanager.azurefleet.models.IpVersion; +import com.azure.resourcemanager.azurefleet.models.KeyVaultSecretReference; +import com.azure.resourcemanager.azurefleet.models.LinuxConfiguration; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.azurefleet.models.Mode; +import com.azure.resourcemanager.azurefleet.models.NetworkApiVersion; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliaryMode; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliarySku; +import com.azure.resourcemanager.azurefleet.models.OSImageNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurefleet.models.PatchSettings; +import com.azure.resourcemanager.azurefleet.models.Plan; +import com.azure.resourcemanager.azurefleet.models.ProtocolTypes; +import com.azure.resourcemanager.azurefleet.models.ProxyAgentSettings; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSku; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.ScheduledEventsProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.azurefleet.models.SecurityPostureReference; +import com.azure.resourcemanager.azurefleet.models.SecurityProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityTypes; +import com.azure.resourcemanager.azurefleet.models.ServiceArtifactReference; +import com.azure.resourcemanager.azurefleet.models.SettingNames; +import com.azure.resourcemanager.azurefleet.models.SpotAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SshConfiguration; +import com.azure.resourcemanager.azurefleet.models.SshPublicKey; +import com.azure.resourcemanager.azurefleet.models.StorageAccountTypes; +import com.azure.resourcemanager.azurefleet.models.TerminateNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.UefiSettings; +import com.azure.resourcemanager.azurefleet.models.UserAssignedIdentity; +import com.azure.resourcemanager.azurefleet.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurefleet.models.VMGalleryApplication; +import com.azure.resourcemanager.azurefleet.models.VMSizeProperties; +import com.azure.resourcemanager.azurefleet.models.VaultCertificate; +import com.azure.resourcemanager.azurefleet.models.VaultSecretGroup; +import com.azure.resourcemanager.azurefleet.models.VirtualHardDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import com.azure.resourcemanager.azurefleet.models.WinRMConfiguration; +import com.azure.resourcemanager.azurefleet.models.WinRMListener; +import com.azure.resourcemanager.azurefleet.models.WindowsConfiguration; +import com.azure.resourcemanager.azurefleet.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets CreateOrUpdate. + */ +public final class FleetsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_CreateOrUpdate. + * json + */ + /** + * Sample code: Fleets_CreateOrUpdate. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsCreateOrUpdate(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets() + .define("testFleet") + .withRegion("westus") + .withExistingResourceGroup("rgazurefleet") + .withTags(mapOf("key3518", "fakeTokenPlaceholder")) + .withZones(Arrays.asList("zone1", "zone2")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("key9851", new UserAssignedIdentity()))) + .withPlan(new Plan().withName("jwgrcrnrtfoxn") + .withPublisher("iozjbiqqckqm") + .withProduct("cgopbyvdyqikahwyxfpzwaqk") + .withPromotionCode("fakeTokenPlaceholder") + .withVersion("wa")) + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withMaxPricePerVM(0.00865F) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_d1_v2").withRank(19225))) + .withComputeProfile( + new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("o") + .withAdminUsername("nrgzqciiaaxjrqldbmjbqkyhntp") + .withAdminPassword("fakeTokenPlaceholder") + .withCustomData("xjjib") + .withWindowsConfiguration(new WindowsConfiguration().withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("hlyjiqcfksgrpjrct") + .withAdditionalUnattendContent( + Arrays.asList(new AdditionalUnattendContent() + .withPassName(AdditionalUnattendContentPassName.OOBE_SYSTEM) + .withComponentName( + AdditionalUnattendContentComponentName.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("bubmqbxjkj"))) + .withPatchSettings(new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new WindowsVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + WindowsVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withWinRM(new WinRMConfiguration() + .withListeners(Arrays.asList(new WinRMListener().withProtocol(ProtocolTypes.HTTPS) + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName")))) + .withEnableVMAgentPlatformUpdates(true)) + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true) + .withSsh(new SshConfiguration().withPublicKeys(Arrays + .asList(new SshPublicKey().withPath("kmqz").withKeyData("fakeTokenPlaceholder")))) + .withProvisionVMAgent(true) + .withPatchSettings(new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings(new LinuxVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting(LinuxVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withEnableVMAgentPlatformUpdates(true)) + .withSecrets(Arrays.asList(new VaultSecretGroup().withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")) + .withVaultCertificates(Arrays.asList(new VaultCertificate() + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName") + .withCertificateStore("nlxrwavpzhueffxsshlun"))))) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}") + .withPublisher("mqxgwbiyjzmxavhbkd") + .withOffer("isxgumkarlkomp") + .withSku("eojmppqcrnpmxirtp") + .withVersion("wvpcqefgtmqdgltiuz") + .withSharedGalleryImageId("kmkgihoxwlawuuhcinfirktdwkmx") + .withCommunityGalleryImageId("vlqe")) + .withOsDisk(new VirtualMachineScaleSetOSDisk().withName("wfttw") + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withDiskSizeGB(14) + .withOsType(OperatingSystemTypes.WINDOWS) + .withImage(new VirtualHardDisk().withUri( + "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd")) + .withVhdContainers(Arrays.asList("tkzcwddtinkfpnfklatw")) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks(Arrays.asList(new VirtualMachineScaleSetDataDisk() + .withName("eogiykmdmeikswxmigjws") + .withLun(14) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(6) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDiskIopsReadWrite(27L) + .withDiskMBpsReadWrite(2L) + .withDeleteOption(DiskDeleteOptionTypes.DELETE))) + .withDiskControllerType(DiskControllerTypes.fromString("uzb"))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile() + .withHealthProbe(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}")) + .withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("i") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties() + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withDisableTcpStateTracking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}")) + .withDnsSettings(new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList("nxmmfolhclsesu"))) + .withIpConfigurations(Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("oezqhkidfhyywlfzwuotilrpbqnjg") + .withProperties(new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("fvpqf") + .withProperties( + new VirtualMachineScaleSetPublicIpAddressConfigurationProperties() + .withIdleTimeoutInMinutes(9) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel("ukrddzvmorpmfsczjwtbvp") + .withDomainNameLabelScope( + DomainNameLabelScopeTypes.TENANT_REUSE)) + .withIpTags( + Arrays.asList(new VirtualMachineScaleSetIpTag() + .withIpTagType("sddgsoemnzgqizale") + .withTag("wufmhrjsakbiaetyara"))) + .withPublicIpPrefix(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withSku(new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL))) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"))) + .withApplicationSecurityGroups(Arrays.asList( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"))) + .withLoadBalancerBackendAddressPools(Arrays.asList( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"))) + .withLoadBalancerInboundNatPools( + Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}")))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE) + .withAuxiliaryMode(NetworkInterfaceAuxiliaryMode.NONE) + .withAuxiliarySku(NetworkInterfaceAuxiliarySku.NONE)))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile(new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH) + .withEncryptionIdentity(new EncryptionIdentity().withUserAssignedIdentityResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}")) + .withProxyAgentSettings(new ProxyAgentSettings().withEnabled(true) + .withMode(Mode.AUDIT) + .withKeyIncarnationId(20))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://myStorageAccountName.blob.core.windows.net"))) + .withExtensionProfile(new VirtualMachineScaleSetExtensionProfile() + .withExtensions(Arrays.asList(new VirtualMachineScaleSetExtension().withName("bndxuxx") + .withProperties(new VirtualMachineScaleSetExtensionProperties() + .withForceUpdateTag("yhgxw") + .withPublisher("kpxtirxjfprhs") + .withType("pgjilctjjwaa") + .withTypeHandlerVersion("zevivcoilxmbwlrihhhibq") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings(mapOf()) + .withProtectedSettings(mapOf()) + .withProvisionAfterExtensions(Arrays.asList("nftzosroolbcwmpupujzqwqe")) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault(new KeyVaultSecretReference() + .withSecretUrl("fakeTokenPlaceholder") + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")))))) + .withExtensionsTimeBudget("mbhjahtdygwgyszdwjtvlvtgchdwil")) + .withLicenseType("v") + .withScheduledEventsProfile(new ScheduledEventsProfile() + .withTerminateNotificationProfile(new TerminateNotificationProfile() + .withNotBeforeTimeout("iljppmmw") + .withEnable(true)) + .withOsImageNotificationProfile( + new OSImageNotificationProfile().withNotBeforeTimeout("olbpadmevekyczfokodtfprxti") + .withEnable(true))) + .withUserData("s") + .withCapacityReservation(new CapacityReservationProfile() + .withCapacityReservationGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"))) + .withApplicationProfile(new ApplicationProfile().withGalleryApplications( + Arrays.asList(new VMGalleryApplication().withTags("eyrqjbib") + .withOrder(5) + .withPackageReferenceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}") + .withConfigurationReference("ulztmiavpojpbpbddgnuuiimxcpau") + .withTreatFailureAsDeploymentFailure(true) + .withEnableAutomaticUpgrade(true)))) + .withHardwareProfile(new VirtualMachineScaleSetHardwareProfile() + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(16).withVCpusPerCore(23))) + .withServiceArtifactReference(new ServiceArtifactReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}")) + .withSecurityPostureReference(new SecurityPostureReference().withId( + "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest") + .withExcludeExtensions(Arrays.asList("{securityPostureVMExtensionName}")) + .withIsOverridable(true))) + .withComputeApiVersion("2023-07-01") + .withPlatformFaultDomainCount(1)) + .create(); + } + + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_CreateOrUpdate_MinimumSet.json + */ + /** + * Sample code: Fleets_CreateOrUpdate_MinimumSet. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsCreateOrUpdateMinimumSet(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets() + .define("testFleet") + .withRegion("eastus2euap") + .withExistingResourceGroup("rgazurefleet") + .withTags(mapOf("key", "fakeTokenPlaceholder")) + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(2) + .withMinCapacity(1) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(2) + .withMinCapacity(1) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_D2s_v3"), + new VmSizeProfile().withName("Standard_D4s_v3"), new VmSizeProfile().withName("Standard_E2s_v3"))) + .withComputeProfile(new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("prefix") + .withAdminUsername("azureuser") + .withAdminPassword("fakeTokenPlaceholder") + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(false))) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withPublisher("canonical") + .withOffer("0001-com-ubuntu-server-focal") + .withSku("20_04-lts-gen2") + .withVersion("latest")) + .withOsDisk(new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withOsType(OperatingSystemTypes.LINUX) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile().withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("vmNameTest") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties().withPrimary(true) + .withEnableAcceleratedNetworking(false) + .withIpConfigurations(Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("vmNameTest") + .withProperties(new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withLoadBalancerBackendAddressPools(Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}")))))) + .withEnableIpForwarding(true)))) + .withNetworkApiVersion(NetworkApiVersion.fromString("2022-07-01")))) + .withComputeApiVersion("2023-09-01") + .withPlatformFaultDomainCount(1)) + .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/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsDeleteSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsDeleteSamples.java new file mode 100644 index 0000000000000..d6c023dabc574 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Fleets Delete. + */ +public final class FleetsDeleteSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Delete.json + */ + /** + * Sample code: Fleets_Delete. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsDelete(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().delete("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsGetByResourceGroupSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..1f91c71baf134 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Fleets GetByResourceGroup. + */ +public final class FleetsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Get.json + */ + /** + * Sample code: Fleets_Get. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsGet(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().getByResourceGroupWithResponse("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListByResourceGroupSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..03611474f8c21 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Fleets ListByResourceGroup. + */ +public final class FleetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListByResourceGroup.json + */ + /** + * Sample code: Fleets_ListByResourceGroup. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsListByResourceGroup(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().listByResourceGroup("rgazurefleet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListSamples.java new file mode 100644 index 0000000000000..554202119a337 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Fleets List. + */ +public final class FleetsListSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListBySubscription.json + */ + /** + * Sample code: Fleets_ListBySubscription. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsListBySubscription(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListVirtualMachineScaleSetsSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListVirtualMachineScaleSetsSamples.java new file mode 100644 index 0000000000000..5ea9dee6c9a40 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsListVirtualMachineScaleSetsSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Fleets ListVirtualMachineScaleSets. + */ +public final class FleetsListVirtualMachineScaleSetsSamples { + /* + * x-ms-original-file: specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/ + * Fleets_ListVirtualMachineScaleSets.json + */ + /** + * Sample code: Fleets_ListVirtualMachineScaleSets. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void + fleetsListVirtualMachineScaleSets(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.fleets().listVirtualMachineScaleSets("rgazurefleet", "myFleet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsUpdateSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsUpdateSamples.java new file mode 100644 index 0000000000000..7f5ea87e40cd9 --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/FleetsUpdateSamples.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +import com.azure.core.management.SubResource; +import com.azure.resourcemanager.azurefleet.fluent.models.FleetProperties; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContent; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentComponentName; +import com.azure.resourcemanager.azurefleet.models.AdditionalUnattendContentPassName; +import com.azure.resourcemanager.azurefleet.models.ApiEntityReference; +import com.azure.resourcemanager.azurefleet.models.ApplicationProfile; +import com.azure.resourcemanager.azurefleet.models.BaseVirtualMachineProfile; +import com.azure.resourcemanager.azurefleet.models.BootDiagnostics; +import com.azure.resourcemanager.azurefleet.models.CachingTypes; +import com.azure.resourcemanager.azurefleet.models.CapacityReservationProfile; +import com.azure.resourcemanager.azurefleet.models.ComputeProfile; +import com.azure.resourcemanager.azurefleet.models.DeleteOptions; +import com.azure.resourcemanager.azurefleet.models.DiagnosticsProfile; +import com.azure.resourcemanager.azurefleet.models.DiffDiskOptions; +import com.azure.resourcemanager.azurefleet.models.DiffDiskPlacement; +import com.azure.resourcemanager.azurefleet.models.DiffDiskSettings; +import com.azure.resourcemanager.azurefleet.models.DiskControllerTypes; +import com.azure.resourcemanager.azurefleet.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskDeleteOptionTypes; +import com.azure.resourcemanager.azurefleet.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.azurefleet.models.DomainNameLabelScopeTypes; +import com.azure.resourcemanager.azurefleet.models.EncryptionIdentity; +import com.azure.resourcemanager.azurefleet.models.EvictionPolicy; +import com.azure.resourcemanager.azurefleet.models.Fleet; +import com.azure.resourcemanager.azurefleet.models.ImageReference; +import com.azure.resourcemanager.azurefleet.models.IpVersion; +import com.azure.resourcemanager.azurefleet.models.KeyVaultSecretReference; +import com.azure.resourcemanager.azurefleet.models.LinuxConfiguration; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.LinuxPatchSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.azurefleet.models.ManagedServiceIdentityUpdate; +import com.azure.resourcemanager.azurefleet.models.Mode; +import com.azure.resourcemanager.azurefleet.models.NetworkApiVersion; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliaryMode; +import com.azure.resourcemanager.azurefleet.models.NetworkInterfaceAuxiliarySku; +import com.azure.resourcemanager.azurefleet.models.OSImageNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurefleet.models.PatchSettings; +import com.azure.resourcemanager.azurefleet.models.ProtocolTypes; +import com.azure.resourcemanager.azurefleet.models.ProxyAgentSettings; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSku; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.azurefleet.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.RegularPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.ResourcePlanUpdate; +import com.azure.resourcemanager.azurefleet.models.ScheduledEventsProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityEncryptionTypes; +import com.azure.resourcemanager.azurefleet.models.SecurityPostureReference; +import com.azure.resourcemanager.azurefleet.models.SecurityProfile; +import com.azure.resourcemanager.azurefleet.models.SecurityTypes; +import com.azure.resourcemanager.azurefleet.models.ServiceArtifactReference; +import com.azure.resourcemanager.azurefleet.models.SettingNames; +import com.azure.resourcemanager.azurefleet.models.SpotAllocationStrategy; +import com.azure.resourcemanager.azurefleet.models.SpotPriorityProfile; +import com.azure.resourcemanager.azurefleet.models.SshConfiguration; +import com.azure.resourcemanager.azurefleet.models.SshPublicKey; +import com.azure.resourcemanager.azurefleet.models.StorageAccountTypes; +import com.azure.resourcemanager.azurefleet.models.TerminateNotificationProfile; +import com.azure.resourcemanager.azurefleet.models.UefiSettings; +import com.azure.resourcemanager.azurefleet.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurefleet.models.VMGalleryApplication; +import com.azure.resourcemanager.azurefleet.models.VMSizeProperties; +import com.azure.resourcemanager.azurefleet.models.VaultCertificate; +import com.azure.resourcemanager.azurefleet.models.VaultSecretGroup; +import com.azure.resourcemanager.azurefleet.models.VirtualHardDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtension; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetExtensionProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetHardwareProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetIpTag; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetPublicIpAddressConfigurationProperties; +import com.azure.resourcemanager.azurefleet.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.azurefleet.models.VmSizeProfile; +import com.azure.resourcemanager.azurefleet.models.WinRMConfiguration; +import com.azure.resourcemanager.azurefleet.models.WinRMListener; +import com.azure.resourcemanager.azurefleet.models.WindowsConfiguration; +import com.azure.resourcemanager.azurefleet.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchAutomaticByPlatformSettings; +import com.azure.resourcemanager.azurefleet.models.WindowsVMGuestPatchMode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Fleets Update. + */ +public final class FleetsUpdateSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Fleets_Update.json + */ + /** + * Sample code: Fleets_Update. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void fleetsUpdate(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + Fleet resource = manager.fleets() + .getByResourceGroupWithResponse("rgazurefleet", "testFleet", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withIdentity(new ManagedServiceIdentityUpdate().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withPlan(new ResourcePlanUpdate().withName("jwgrcrnrtfoxn") + .withPublisher("iozjbiqqckqm") + .withProduct("cgopbyvdyqikahwyxfpzwaqk") + .withPromotionCode("fakeTokenPlaceholder") + .withVersion("wa")) + .withProperties(new FleetProperties() + .withSpotPriorityProfile(new SpotPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withMaxPricePerVM(0.00865F) + .withEvictionPolicy(EvictionPolicy.DELETE) + .withAllocationStrategy(SpotAllocationStrategy.PRICE_CAPACITY_OPTIMIZED) + .withMaintain(true)) + .withRegularPriorityProfile(new RegularPriorityProfile().withCapacity(20) + .withMinCapacity(10) + .withAllocationStrategy(RegularPriorityAllocationStrategy.LOWEST_PRICE)) + .withVmSizesProfile(Arrays.asList(new VmSizeProfile().withName("Standard_d1_v2").withRank(19225))) + .withComputeProfile( + new ComputeProfile() + .withBaseVirtualMachineProfile(new BaseVirtualMachineProfile() + .withOsProfile(new VirtualMachineScaleSetOSProfile().withComputerNamePrefix("o") + .withAdminUsername("nrgzqciiaaxjrqldbmjbqkyhntp") + .withAdminPassword("fakeTokenPlaceholder") + .withCustomData("xjjib") + .withWindowsConfiguration(new WindowsConfiguration().withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withTimeZone("hlyjiqcfksgrpjrct") + .withAdditionalUnattendContent( + Arrays.asList(new AdditionalUnattendContent() + .withPassName(AdditionalUnattendContentPassName.OOBE_SYSTEM) + .withComponentName( + AdditionalUnattendContentComponentName.MICROSOFT_WINDOWS_SHELL_SETUP) + .withSettingName(SettingNames.AUTO_LOGON) + .withContent("bubmqbxjkj"))) + .withPatchSettings(new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.MANUAL) + .withEnableHotpatching(true) + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new WindowsVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + WindowsVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withWinRM(new WinRMConfiguration().withListeners(Arrays.asList(new WinRMListener() + .withProtocol(ProtocolTypes.HTTP) + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName")))) + .withEnableVMAgentPlatformUpdates(true)) + .withLinuxConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true) + .withSsh(new SshConfiguration().withPublicKeys(Arrays.asList( + new SshPublicKey().withPath("kmqz").withKeyData("fakeTokenPlaceholder")))) + .withProvisionVMAgent(true) + .withPatchSettings(new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT) + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT) + .withAutomaticByPlatformSettings( + new LinuxVMGuestPatchAutomaticByPlatformSettings() + .withRebootSetting( + LinuxVMGuestPatchAutomaticByPlatformRebootSetting.UNKNOWN) + .withBypassPlatformSafetyChecksOnUserSchedule(true))) + .withEnableVMAgentPlatformUpdates(true)) + .withSecrets(Arrays.asList(new VaultSecretGroup() + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")) + .withVaultCertificates(Arrays.asList(new VaultCertificate() + .withCertificateUrl("https://myVaultName.vault.azure.net/secrets/myCertName") + .withCertificateStore("nlxrwavpzhueffxsshlun"))))) + .withAllowExtensionOperations(true) + .withRequireGuestProvisionSignal(true)) + .withStorageProfile(new VirtualMachineScaleSetStorageProfile() + .withImageReference(new ImageReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}/versions/{versionName}") + .withPublisher("mqxgwbiyjzmxavhbkd") + .withOffer("isxgumkarlkomp") + .withSku("eojmppqcrnpmxirtp") + .withVersion("wvpcqefgtmqdgltiuz") + .withSharedGalleryImageId("kmkgihoxwlawuuhcinfirktdwkmx") + .withCommunityGalleryImageId("vlqe")) + .withOsDisk(new VirtualMachineScaleSetOSDisk().withName("wfttw") + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings(new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withDiskSizeGB(14) + .withOsType(OperatingSystemTypes.WINDOWS) + .withImage(new VirtualHardDisk().withUri( + "https://myStorageAccountName.blob.core.windows.net/myContainerName/myVhdName.vhd")) + .withVhdContainers(Arrays.asList("tkzcwddtinkfpnfklatw")) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDeleteOption(DiskDeleteOptionTypes.DELETE)) + .withDataDisks(Arrays.asList(new VirtualMachineScaleSetDataDisk() + .withName("eogiykmdmeikswxmigjws") + .withLun(14) + .withCaching(CachingTypes.NONE) + .withWriteAcceleratorEnabled(true) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(6) + .withManagedDisk(new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet(new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")) + .withSecurityProfile(new VMDiskSecurityProfile() + .withSecurityEncryptionType(SecurityEncryptionTypes.VMGUEST_STATE_ONLY) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}")))) + .withDiskIopsReadWrite(27L) + .withDiskMBpsReadWrite(2L) + .withDeleteOption(DiskDeleteOptionTypes.DELETE))) + .withDiskControllerType(DiskControllerTypes.fromString("uzb"))) + .withNetworkProfile(new VirtualMachineScaleSetNetworkProfile() + .withHealthProbe(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}")) + .withNetworkInterfaceConfigurations( + Arrays.asList(new VirtualMachineScaleSetNetworkConfiguration().withName("i") + .withProperties(new VirtualMachineScaleSetNetworkConfigurationProperties() + .withPrimary(true) + .withEnableAcceleratedNetworking(true) + .withDisableTcpStateTracking(true) + .withEnableFpga(true) + .withNetworkSecurityGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}")) + .withDnsSettings(new VirtualMachineScaleSetNetworkConfigurationDnsSettings() + .withDnsServers(Arrays.asList("nxmmfolhclsesu"))) + .withIpConfigurations( + Arrays.asList(new VirtualMachineScaleSetIpConfiguration() + .withName("oezqhkidfhyywlfzwuotilrpbqnjg") + .withProperties( + new VirtualMachineScaleSetIpConfigurationProperties() + .withSubnet(new ApiEntityReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}")) + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("fvpqf") + .withProperties( + new VirtualMachineScaleSetPublicIpAddressConfigurationProperties() + .withIdleTimeoutInMinutes(9) + .withDnsSettings( + new VirtualMachineScaleSetPublicIpAddressConfigurationDnsSettings() + .withDomainNameLabel( + "ukrddzvmorpmfsczjwtbvp") + .withDomainNameLabelScope( + DomainNameLabelScopeTypes.TENANT_REUSE)) + .withIpTags(Arrays.asList( + new VirtualMachineScaleSetIpTag() + .withIpTagType("sddgsoemnzgqizale") + .withTag("wufmhrjsakbiaetyara"))) + .withPublicIpPrefix( + new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}")) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withDeleteOption(DeleteOptions.DELETE)) + .withSku(new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.REGIONAL))) + .withPrivateIpAddressVersion(IpVersion.IPV4) + .withApplicationGatewayBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}"))) + .withApplicationSecurityGroups(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}"))) + .withLoadBalancerBackendAddressPools(Arrays + .asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}"))) + .withLoadBalancerInboundNatPools( + Arrays.asList(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}")))))) + .withEnableIpForwarding(true) + .withDeleteOption(DeleteOptions.DELETE) + .withAuxiliaryMode(NetworkInterfaceAuxiliaryMode.NONE) + .withAuxiliarySku(NetworkInterfaceAuxiliarySku.NONE)))) + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE)) + .withSecurityProfile(new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withEncryptionAtHost(true) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH) + .withEncryptionIdentity(new EncryptionIdentity().withUserAssignedIdentityResourceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{userAssignedIdentityName}")) + .withProxyAgentSettings(new ProxyAgentSettings().withEnabled(true) + .withMode(Mode.AUDIT) + .withKeyIncarnationId(20))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://myStorageAccountName.blob.core.windows.net"))) + .withExtensionProfile(new VirtualMachineScaleSetExtensionProfile() + .withExtensions(Arrays.asList(new VirtualMachineScaleSetExtension().withName("bndxuxx") + .withProperties(new VirtualMachineScaleSetExtensionProperties() + .withForceUpdateTag("yhgxw") + .withPublisher("kpxtirxjfprhs") + .withType("pgjilctjjwaa") + .withTypeHandlerVersion("zevivcoilxmbwlrihhhibq") + .withAutoUpgradeMinorVersion(true) + .withEnableAutomaticUpgrade(true) + .withSettings(mapOf()) + .withProtectedSettings(mapOf()) + .withProvisionAfterExtensions(Arrays.asList("nftzosroolbcwmpupujzqwqe")) + .withSuppressFailures(true) + .withProtectedSettingsFromKeyVault(new KeyVaultSecretReference() + .withSecretUrl("fakeTokenPlaceholder") + .withSourceVault(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}")))))) + .withExtensionsTimeBudget("mbhjahtdygwgyszdwjtvlvtgchdwil")) + .withLicenseType("v") + .withScheduledEventsProfile(new ScheduledEventsProfile() + .withTerminateNotificationProfile(new TerminateNotificationProfile() + .withNotBeforeTimeout("iljppmmw") + .withEnable(true)) + .withOsImageNotificationProfile( + new OSImageNotificationProfile().withNotBeforeTimeout("olbpadmevekyczfokodtfprxti") + .withEnable(true))) + .withUserData("s") + .withCapacityReservation(new CapacityReservationProfile() + .withCapacityReservationGroup(new SubResource().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"))) + .withApplicationProfile(new ApplicationProfile().withGalleryApplications( + Arrays.asList(new VMGalleryApplication().withTags("eyrqjbib") + .withOrder(5) + .withPackageReferenceId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{applicationName}/versions/{versionName}") + .withConfigurationReference("ulztmiavpojpbpbddgnuuiimxcpau") + .withTreatFailureAsDeploymentFailure(true) + .withEnableAutomaticUpgrade(true)))) + .withHardwareProfile( + new VirtualMachineScaleSetHardwareProfile().withVmSizeProperties(new VMSizeProperties() + .withVCpusAvailable(16) + .withVCpusPerCore(23))) + .withServiceArtifactReference(new ServiceArtifactReference().withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactsName}/vmArtifactsProfiles/{vmArtifactsProfileName}")) + .withSecurityPostureReference(new SecurityPostureReference().withId( + "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest") + .withExcludeExtensions(Arrays.asList("{securityPostureVMExtensionName}")) + .withIsOverridable(true))) + .withComputeApiVersion("2023-07-01") + .withPlatformFaultDomainCount(1))) + .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/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/OperationsListSamples.java b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..d975ade0145ee --- /dev/null +++ b/sdk/azurefleet/azure-resourcemanager-azurefleet/src/samples/java/com/azure/resourcemanager/azurefleet/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.azurefleet.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/azurefleet/resource-manager/Microsoft.AzureFleet/stable/2024-11-01/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AzurefleetManager. + */ + public static void operationsList(com.azure.resourcemanager.azurefleet.AzurefleetManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurefleet/ci.yml b/sdk/azurefleet/ci.yml new file mode 100644 index 0000000000000..0d11537f87db8 --- /dev/null +++ b/sdk/azurefleet/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/azurefleet/ci.yml + - sdk/azurefleet/azure-resourcemanager-azurefleet/ + exclude: + - sdk/azurefleet/pom.xml + - sdk/azurefleet/azure-resourcemanager-azurefleet/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurefleet/ci.yml + - sdk/azurefleet/azure-resourcemanager-azurefleet/ + exclude: + - sdk/azurefleet/pom.xml + - sdk/azurefleet/azure-resourcemanager-azurefleet/pom.xml + +parameters: + - name: release_azureresourcemanagerazurefleet + displayName: azure-resourcemanager-azurefleet + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azurefleet + Artifacts: + - name: azure-resourcemanager-azurefleet + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerazurefleet + releaseInBatch: ${{ parameters.release_azureresourcemanagerazurefleet }} diff --git a/sdk/azurefleet/pom.xml b/sdk/azurefleet/pom.xml new file mode 100644 index 0000000000000..c94f40dc5dc21 --- /dev/null +++ b/sdk/azurefleet/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-azurefleet-service + pom + 1.0.0 + + + azure-resourcemanager-azurefleet + +