diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f64b70065d1d9..b479f5abab402 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -524,6 +524,7 @@ com.azure.resourcemanager:azure-resourcemanager-edgeoperator;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-resources-deployments;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resources-policy;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resources-templatespecs;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-deviceregistry-softwareupdate;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-compute-workloadmanager;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-koreaiartemis;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datatransfer;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/CHANGELOG.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/CHANGELOG.md new file mode 100644 index 0000000000000..f397410a0bffd --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.1 (2026-11-19) + +- Azure Resource Manager Device Registry Software Update client library for Java. This package contains Microsoft Azure SDK for Device Registry Software Update Management SDK. Microsoft Device Update resource provider. Package api-version 2026-11-02-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-deviceregistry-softwareupdate Java SDK. + diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/README.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/README.md new file mode 100644 index 0000000000000..f02223c6a4a28 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Device Registry Software Update client library for Java + +Azure Resource Manager Device Registry Software Update client library for Java. + +This package contains Microsoft Azure SDK for Device Registry Software Update Management SDK. Microsoft Device Update resource provider. Package api-version 2026-11-02-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-deviceregistry-softwareupdate;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-deviceregistry-softwareupdate + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/SAMPLE.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/SAMPLE.md new file mode 100644 index 0000000000000..b0a40968ec508 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/SAMPLE.md @@ -0,0 +1,245 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## UpdateInstances + +- [CheckNameAvailability](#updateinstances_checknameavailability) +- [Create](#updateinstances_create) +- [Delete](#updateinstances_delete) +- [GetByResourceGroup](#updateinstances_getbyresourcegroup) +- [List](#updateinstances_list) +- [ListByResourceGroup](#updateinstances_listbyresourcegroup) +- [Update](#updateinstances_update) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-11-02-preview/Operations_List.json + */ + /** + * Sample code: Gets the list of operations. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsTheListOfOperations( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_CheckNameAvailability + +```java +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; + +/** + * Samples for UpdateInstances CheckNameAvailability. + */ +public final class UpdateInstancesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_CheckNameAvailability.json + */ + /** + * Sample code: Check Update Instance name availability. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void checkUpdateInstanceNameAvailability( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("contoso") + .withType("Microsoft.DeviceUpdate/updateInstances"), com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_Create + +```java +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for UpdateInstances Create. + */ +public final class UpdateInstancesCreateSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Create.json + */ + /** + * Sample code: Creates or updates an Update Instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void createsOrUpdatesAnUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .define("contoso") + .withRegion("eastus2") + .withExistingResourceGroup("test-rg") + .withTags(mapOf("env", "prod")) + .withProperties(new UpdateInstancePropertiesInner()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-mi", + new UserAssignedIdentity()))) + .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; + } +} +``` + +### UpdateInstances_Delete + +```java +/** + * Samples for UpdateInstances Delete. + */ +public final class UpdateInstancesDeleteSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Delete.json + */ + /** + * Sample code: Deletes an update instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void deletesAnUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().delete("test-rg", "contoso", com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_GetByResourceGroup + +```java +/** + * Samples for UpdateInstances GetByResourceGroup. + */ +public final class UpdateInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Get.json + */ + /** + * Sample code: Gets Update Instance details. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsUpdateInstanceDetails( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .getByResourceGroupWithResponse("test-rg", "contoso", com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_List + +```java +/** + * Samples for UpdateInstances List. + */ +public final class UpdateInstancesListSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_ListBySubscription.json + */ + /** + * Sample code: Gets list of Update Instances by Subscription. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsListOfUpdateInstancesBySubscription( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().list(com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_ListByResourceGroup + +```java +/** + * Samples for UpdateInstances ListByResourceGroup. + */ +public final class UpdateInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_ListByResourceGroup.json + */ + /** + * Sample code: Gets list of Update Instances. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsListOfUpdateInstances( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### UpdateInstances_Update + +```java +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for UpdateInstances Update. + */ +public final class UpdateInstancesUpdateSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Update.json + */ + /** + * Sample code: Updates Update Instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void updatesUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + UpdateInstance resource = manager.updateInstances() + .getByResourceGroupWithResponse("test-rg", "contoso", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/pom.xml b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/pom.xml new file mode 100644 index 0000000000000..23aac35452f5e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-deviceregistry-softwareupdate + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Device Registry Software Update Management + This package contains Microsoft Azure SDK for Device Registry Software Update Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Device Update resource provider. Package api-version 2026-11-02-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.61.0 + + + com.azure + azure-core-management + 1.20.0 + + + com.azure + azure-core-test + 1.27.0-beta.20 + test + + + com.azure + azure-identity + 1.19.0 + test + + + diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateManager.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateManager.java new file mode 100644 index 0000000000000..ac06badcdc8b0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateManager.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.DeviceRegistrySoftwareUpdateManagementClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.DeviceRegistrySoftwareUpdateManagementClientBuilder; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.OperationsImpl; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.UpdateInstancesImpl; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Operations; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstances; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to DeviceRegistrySoftwareUpdateManager. + * Microsoft Device Update resource provider. + */ +public final class DeviceRegistrySoftwareUpdateManager { + private Operations operations; + + private UpdateInstances updateInstances; + + private final DeviceRegistrySoftwareUpdateManagementClient clientObject; + + private DeviceRegistrySoftwareUpdateManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DeviceRegistrySoftwareUpdateManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Device Registry Software Update service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Device Registry Software Update service API instance. + */ + public static DeviceRegistrySoftwareUpdateManager 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 Device Registry Software Update service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Device Registry Software Update service API instance. + */ + public static DeviceRegistrySoftwareUpdateManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DeviceRegistrySoftwareUpdateManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DeviceRegistrySoftwareUpdateManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DeviceRegistrySoftwareUpdateManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-deviceregistry-softwareupdate.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Device Registry Software Update service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Device Registry Software Update service API instance. + */ + public DeviceRegistrySoftwareUpdateManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.deviceregistry.softwareupdate") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DeviceRegistrySoftwareUpdateManager(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 UpdateInstances. It manages UpdateInstance. + * + * @return Resource collection API of UpdateInstances. + */ + public UpdateInstances updateInstances() { + if (this.updateInstances == null) { + this.updateInstances = new UpdateInstancesImpl(clientObject.getUpdateInstances(), this); + } + return updateInstances; + } + + /** + * Gets wrapped service client DeviceRegistrySoftwareUpdateManagementClient providing direct access to the + * underlying auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client DeviceRegistrySoftwareUpdateManagementClient. + */ + public DeviceRegistrySoftwareUpdateManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/DeviceRegistrySoftwareUpdateManagementClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/DeviceRegistrySoftwareUpdateManagementClient.java new file mode 100644 index 0000000000000..5882d9f548130 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/DeviceRegistrySoftwareUpdateManagementClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DeviceRegistrySoftwareUpdateManagementClient class. + */ +public interface DeviceRegistrySoftwareUpdateManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the UpdateInstancesClient object to access its operations. + * + * @return the UpdateInstancesClient object. + */ + UpdateInstancesClient getUpdateInstances(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/OperationsClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/OperationsClient.java new file mode 100644 index 0000000000000..4a204dfb6ffd3 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.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/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/UpdateInstancesClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/UpdateInstancesClient.java new file mode 100644 index 0000000000000..de636854b6a71 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/UpdateInstancesClient.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceUpdate; + +/** + * An instance of this class provides access to all the operations defined in UpdateInstancesClient. + */ +public interface UpdateInstancesClient { + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String updateInstanceName, + Context context); + + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateInstanceInner getByResourceGroup(String resourceGroupName, String updateInstanceName); + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateInstanceInner> beginCreate(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource); + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateInstanceInner> beginCreate(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource, Context context); + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateInstanceInner create(String resourceGroupName, String updateInstanceName, UpdateInstanceInner resource); + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateInstanceInner create(String resourceGroupName, String updateInstanceName, UpdateInstanceInner resource, + Context context); + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateInstanceInner> beginUpdate(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties); + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateInstanceInner> beginUpdate(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties, Context context); + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateInstanceInner update(String resourceGroupName, String updateInstanceName, UpdateInstanceUpdate properties); + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateInstanceInner update(String resourceGroupName, String updateInstanceName, UpdateInstanceUpdate properties, + Context context); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 updateInstanceName); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 updateInstanceName, + Context context); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 updateInstanceName); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 updateInstanceName, Context context); + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns list of Update Instances. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns list of Update Instances. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context); + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailabilityRequest body); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/AccountLinkingInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/AccountLinkingInner.java new file mode 100644 index 0000000000000..d7c7ab6c92443 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/AccountLinkingInner.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.models.AccountLinkingState; +import java.io.IOException; + +/** + * Account linking information. Present only after the first /link/initiate. + */ +@Immutable +public final class AccountLinkingInner implements JsonSerializable { + /* + * The ARM resource ID of the linked Azure Device Registry namespace. + */ + private String namespaceResourceId; + + /* + * The current linking state. Absent before any link attempt (logical NotLinked state). + * See AccountLinkingState for the full state machine and transition rules. + */ + private AccountLinkingState linkingState; + + /** + * Creates an instance of AccountLinkingInner class. + */ + private AccountLinkingInner() { + } + + /** + * Get the namespaceResourceId property: The ARM resource ID of the linked Azure Device Registry namespace. + * + * @return the namespaceResourceId value. + */ + public String namespaceResourceId() { + return this.namespaceResourceId; + } + + /** + * Get the linkingState property: The current linking state. Absent before any link attempt (logical NotLinked + * state). + * See AccountLinkingState for the full state machine and transition rules. + * + * @return the linkingState value. + */ + public AccountLinkingState linkingState() { + return this.linkingState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("namespaceResourceId", this.namespaceResourceId); + jsonWriter.writeStringField("linkingState", this.linkingState == null ? null : this.linkingState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountLinkingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountLinkingInner 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 AccountLinkingInner. + */ + public static AccountLinkingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountLinkingInner deserializedAccountLinkingInner = new AccountLinkingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("namespaceResourceId".equals(fieldName)) { + deserializedAccountLinkingInner.namespaceResourceId = reader.getString(); + } else if ("linkingState".equals(fieldName)) { + deserializedAccountLinkingInner.linkingState = AccountLinkingState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountLinkingInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..cc50db4406b3c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.models.CheckNameAvailabilityReason; +import java.io.IOException; + +/** + * The check availability result. + */ +@Immutable +public final class CheckNameAvailabilityResultInner implements JsonSerializable { + /* + * Indicates if the resource name is available. + */ + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is not available. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResultInner class. + */ + private CheckNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResultInner 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 CheckNameAvailabilityResultInner. + */ + public static CheckNameAvailabilityResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResultInner deserializedCheckNameAvailabilityResultInner + = new CheckNameAvailabilityResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResultInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/OperationInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..9813e49e911d6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.models.ActionType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.OperationDisplay; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstanceInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstanceInner.java new file mode 100644 index 0000000000000..912b198258ed2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstanceInner.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * Device Update instance details. + */ +@Fluent +public final class UpdateInstanceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private UpdateInstancePropertiesInner properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of UpdateInstanceInner class. + */ + public UpdateInstanceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public UpdateInstancePropertiesInner properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the UpdateInstanceInner object itself. + */ + public UpdateInstanceInner withProperties(UpdateInstancePropertiesInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the UpdateInstanceInner object itself. + */ + public UpdateInstanceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public UpdateInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public UpdateInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateInstanceInner 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 UpdateInstanceInner. + */ + public static UpdateInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateInstanceInner deserializedUpdateInstanceInner = new UpdateInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedUpdateInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedUpdateInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedUpdateInstanceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedUpdateInstanceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateInstanceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedUpdateInstanceInner.properties = UpdateInstancePropertiesInner.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedUpdateInstanceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedUpdateInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateInstanceInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstancePropertiesInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstancePropertiesInner.java new file mode 100644 index 0000000000000..0e154d1620961 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstancePropertiesInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.models.ProvisioningState; +import java.io.IOException; + +/** + * Update Instance properties. + * + * All properties are read-only because resource state is managed exclusively + * through the internal link* action endpoints. + */ +@Immutable +public final class UpdateInstancePropertiesInner implements JsonSerializable { + /* + * Provisioning state. + */ + private ProvisioningState provisioningState; + + /* + * Service-facing address for ADR→ADU communication. + */ + private String serviceAddress; + + /* + * Account linking state. Absent until first /link/initiate. + */ + private AccountLinkingInner linking; + + /** + * Creates an instance of UpdateInstancePropertiesInner class. + */ + public UpdateInstancePropertiesInner() { + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the serviceAddress property: Service-facing address for ADR→ADU communication. + * + * @return the serviceAddress value. + */ + public String serviceAddress() { + return this.serviceAddress; + } + + /** + * Get the linking property: Account linking state. Absent until first /link/initiate. + * + * @return the linking value. + */ + public AccountLinkingInner linking() { + return this.linking; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateInstancePropertiesInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateInstancePropertiesInner 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 UpdateInstancePropertiesInner. + */ + public static UpdateInstancePropertiesInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateInstancePropertiesInner deserializedUpdateInstancePropertiesInner + = new UpdateInstancePropertiesInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedUpdateInstancePropertiesInner.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("serviceAddress".equals(fieldName)) { + deserializedUpdateInstancePropertiesInner.serviceAddress = reader.getString(); + } else if ("linking".equals(fieldName)) { + deserializedUpdateInstancePropertiesInner.linking = AccountLinkingInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateInstancePropertiesInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/package-info.java new file mode 100644 index 0000000000000..e23f1d6f14316 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/package-info.java new file mode 100644 index 0000000000000..4c08e2979f253 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate.fluent; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/AccountLinkingImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/AccountLinkingImpl.java new file mode 100644 index 0000000000000..e623e7580afed --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/AccountLinkingImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.AccountLinking; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.AccountLinkingState; + +public final class AccountLinkingImpl implements AccountLinking { + private AccountLinkingInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + AccountLinkingImpl(AccountLinkingInner innerObject, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String namespaceResourceId() { + return this.innerModel().namespaceResourceId(); + } + + public AccountLinkingState linkingState() { + return this.innerModel().linkingState(); + } + + public AccountLinkingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/CheckNameAvailabilityResultImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..5d362e29a3941 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityResult; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientBuilder.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientBuilder.java new file mode 100644 index 0000000000000..e7bf39e211edf --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientBuilder.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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 DeviceRegistrySoftwareUpdateManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DeviceRegistrySoftwareUpdateManagementClientImpl.class }) +public final class DeviceRegistrySoftwareUpdateManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder 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 DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder 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 DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder 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 DeviceRegistrySoftwareUpdateManagementClientBuilder. + */ + public DeviceRegistrySoftwareUpdateManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DeviceRegistrySoftwareUpdateManagementClientImpl with the provided parameters. + * + * @return an instance of DeviceRegistrySoftwareUpdateManagementClientImpl. + */ + public DeviceRegistrySoftwareUpdateManagementClientImpl 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(); + DeviceRegistrySoftwareUpdateManagementClientImpl client + = new DeviceRegistrySoftwareUpdateManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientImpl.java new file mode 100644 index 0000000000000..b5dbd331622cb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientImpl.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.DeviceRegistrySoftwareUpdateManagementClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.OperationsClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient; +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 DeviceRegistrySoftwareUpdateManagementClientImpl type. + */ +@ServiceClient(builder = DeviceRegistrySoftwareUpdateManagementClientBuilder.class) +public final class DeviceRegistrySoftwareUpdateManagementClientImpl + implements DeviceRegistrySoftwareUpdateManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The UpdateInstancesClient object to access its operations. + */ + private final UpdateInstancesClient updateInstances; + + /** + * Gets the UpdateInstancesClient object to access its operations. + * + * @return the UpdateInstancesClient object. + */ + public UpdateInstancesClient getUpdateInstances() { + return this.updateInstances; + } + + /** + * Initializes an instance of DeviceRegistrySoftwareUpdateManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + DeviceRegistrySoftwareUpdateManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2026-11-02-preview"; + this.operations = new OperationsClientImpl(this); + this.updateInstances = new UpdateInstancesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Waits for completion and gets the final result, or throws an error. + * + * @param poller the synchronous poller. + * @param type of poll result. + * @param type of final result. + * @return the final result. + * @throws ManagementException if the long running operation fails. + */ + public U getLroFinalResultOrError(SyncPoller, U> poller) { + PollResponse> response = poller.waitForCompletion(); + ManagementException exception = getLroException(response.getStatus(), response.getValue()); + if (exception != null) { + throw exception; + } + return poller.getFinalResult(); + } + + /** + * 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) { + ManagementException exception = getLroException(response.getStatus(), response.getValue()); + if (exception != null) { + return Mono.error(exception); + } + return response.getFinalResult(); + } + + private ManagementException getLroException(LongRunningOperationStatus status, PollResult result) { + PollResult.Error lroError = result == null ? null : result.getError(); + if (status != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED || lroError != null) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = lroError.getMessage(); + String errorBody = lroError.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(status.toString(), errorMessage); + } + return new ManagementException(errorMessage, errorResponse, managementError); + } + return null; + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? new byte[0] : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceRegistrySoftwareUpdateManagementClientImpl.class); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationImpl.java new file mode 100644 index 0000000000000..568d957c40eb2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ActionType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Operation; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.OperationDisplay; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager 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.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..6c0c0666785e0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsClientImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.fluent.OperationsClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistrySoftwareUpdateManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DeviceRegistrySoftwareUpdateManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistrySoftwareUpdateManagementClientOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistrySoftwareUpdateManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DeviceUpdate/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DeviceUpdate/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + return listSinglePage(Context.NONE); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return list(Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + return listNextSinglePage(nextLink, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..496099be96d43 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.fluent.OperationsClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Operation; +import com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + return this.list(Context.NONE); + } + + 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.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/ResourceManagerUtils.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..a270cff190777 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/ResourceManagerUtils.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.logging.ClientLogger; +import java.util.Arrays; +import java.util.Iterator; +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 getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null || parameterName == null) { + return null; + } + String[] idSegments = id.split("/", -1); + String[] pathSegments = pathTemplate.split("/", -1); + int idStart = idSegments[0].isEmpty() ? 1 : 0; + int pathStart = pathSegments[0].isEmpty() ? 1 : 0; + if (idStart == idSegments.length || pathStart == pathSegments.length) { + return null; + } + for (int i = idStart; i < idSegments.length; ++i) { + if (idSegments[i].isEmpty()) { + return null; + } + } + String parameterPlaceholder = "{" + parameterName + "}"; + String value = null; + int idIndex = idSegments.length - 1; + for (int pathIndex = pathSegments.length - 1; pathIndex >= pathStart; --pathIndex, --idIndex) { + String pathSegment = pathSegments[pathIndex]; + boolean isParameter = pathSegment.startsWith("{") && pathSegment.endsWith("}"); + if (pathIndex == pathStart && isParameter) { + // A leading scope can span multiple segments, or be empty for tenant resources. + if (pathSegment.equalsIgnoreCase(parameterPlaceholder)) { + value = String.join("/", Arrays.copyOfRange(idSegments, idStart, idIndex + 1)); + } + idIndex = idStart; + } else if (idIndex < idStart) { + return null; + } else if (!isParameter && !pathSegment.equalsIgnoreCase(idSegments[idIndex])) { + return null; + } else if (pathSegment.equalsIgnoreCase(parameterPlaceholder)) { + value = idSegments[idIndex]; + } + } + return idIndex < idStart ? value : null; + } + + static String getRequiredValueFromIdByParameterName(String id, String pathTemplate, String parameterName, + String segmentName, ClientLogger logger) { + String value = getValueFromIdByParameterName(id, pathTemplate, parameterName); + if (value == null) { + throw logger.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment '%s'.", id, segmentName))); + } + return value; + } + + 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/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstanceImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstanceImpl.java new file mode 100644 index 0000000000000..c0b7bbcb8e9fe --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstanceImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceProperties; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceUpdate; +import java.util.Collections; +import java.util.Map; + +public final class UpdateInstanceImpl implements UpdateInstance, UpdateInstance.Definition, UpdateInstance.Update { + private UpdateInstanceInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager 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 UpdateInstanceProperties properties() { + UpdateInstancePropertiesInner inner = this.innerModel().properties(); + if (inner != null) { + return new UpdateInstancePropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public UpdateInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String updateInstanceName; + + private UpdateInstanceUpdate updateProperties; + + public UpdateInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public UpdateInstance create() { + return this.create(Context.NONE); + } + + public UpdateInstance create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getUpdateInstances() + .create(resourceGroupName, updateInstanceName, this.innerModel(), context); + return this; + } + + UpdateInstanceImpl(String name, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerObject = new UpdateInstanceInner(); + this.serviceManager = serviceManager; + this.updateInstanceName = name; + } + + public UpdateInstanceImpl update() { + this.updateProperties = new UpdateInstanceUpdate(); + return this; + } + + public UpdateInstance apply() { + return this.apply(Context.NONE); + } + + public UpdateInstance apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getUpdateInstances() + .update(resourceGroupName, updateInstanceName, updateProperties, context); + return this; + } + + UpdateInstanceImpl(UpdateInstanceInner innerObject, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "resourceGroupName"); + this.updateInstanceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "updateInstanceName"); + } + + public UpdateInstance refresh() { + return this.refresh(Context.NONE); + } + + public UpdateInstance refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getUpdateInstances() + .getByResourceGroupWithResponse(resourceGroupName, updateInstanceName, context) + .getValue(); + return this; + } + + public UpdateInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public UpdateInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public UpdateInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public UpdateInstanceImpl withProperties(UpdateInstancePropertiesInner properties) { + this.innerModel().withProperties(properties); + return this; + } + + public UpdateInstanceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancePropertiesImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancePropertiesImpl.java new file mode 100644 index 0000000000000..f140cb7011ad0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancePropertiesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.AccountLinking; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ProvisioningState; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceProperties; + +public final class UpdateInstancePropertiesImpl implements UpdateInstanceProperties { + private UpdateInstancePropertiesInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + UpdateInstancePropertiesImpl(UpdateInstancePropertiesInner innerObject, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String serviceAddress() { + return this.innerModel().serviceAddress(); + } + + public AccountLinking linking() { + AccountLinkingInner inner = this.innerModel().linking(); + if (inner != null) { + return new AccountLinkingImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateInstancePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesClientImpl.java new file mode 100644 index 0000000000000..ee9fe09ee8cc9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesClientImpl.java @@ -0,0 +1,1735 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkInitiateRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkNotifyRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkUpdateRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.UpdateInstanceListResult; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceUpdate; +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 UpdateInstancesClient. + */ +public final class UpdateInstancesClientImpl implements UpdateInstancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final UpdateInstancesService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistrySoftwareUpdateManagementClientImpl client; + + /** + * Initializes an instance of UpdateInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UpdateInstancesClientImpl(DeviceRegistrySoftwareUpdateManagementClientImpl client) { + this.service + = RestProxy.create(UpdateInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistrySoftwareUpdateManagementClientUpdateInstances to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistrySoftwareUpdateManagementClientUpdateInstances") + public interface UpdateInstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") UpdateInstanceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") UpdateInstanceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") UpdateInstanceUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") UpdateInstanceUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/updateInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/updateInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkNameAvailabilitySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkPreflight") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> linkPreflight(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkPreflightRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkPreflight") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkPreflightSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkPreflightRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkInitiate") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> linkInitiate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkInitiateRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkInitiate") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkInitiateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkInitiateRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkNotify") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> linkNotify(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkNotifyRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkNotify") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkNotifySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkNotifyRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkUpdate") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> linkUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkUpdateRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}/linkUpdate") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response linkUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("updateInstanceName") String updateInstanceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LinkUpdateRequest body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String updateInstanceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String updateInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, updateInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String updateInstanceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, accept, context); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateInstanceInner getByResourceGroup(String resourceGroupName, String updateInstanceName) { + return getByResourceGroupWithResponse(resourceGroupName, updateInstanceName, Context.NONE).getValue(); + } + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String updateInstanceName, + UpdateInstanceInner resource) { + return createWithResponse(resourceGroupName, updateInstanceName, resource, Context.NONE); + } + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String updateInstanceName, + UpdateInstanceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, resource, + context); + } + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, UpdateInstanceInner> beginCreateAsync(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, updateInstanceName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + UpdateInstanceInner.class, UpdateInstanceInner.class, this.client.getContext()); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateInstanceInner> beginCreate(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource) { + return beginCreate(resourceGroupName, updateInstanceName, resource, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateInstanceInner> beginCreate(String resourceGroupName, + String updateInstanceName, UpdateInstanceInner resource, Context context) { + Response response = createWithResponse(resourceGroupName, updateInstanceName, resource, context); + return this.client.getLroResult(response, UpdateInstanceInner.class, + UpdateInstanceInner.class, context); + } + + /** + * Creates or updates an Update Instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param resource Update Instance details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String updateInstanceName, + UpdateInstanceInner resource) { + return beginCreateAsync(resourceGroupName, updateInstanceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateInstanceInner create(String resourceGroupName, String updateInstanceName, + UpdateInstanceInner resource) { + return create(resourceGroupName, updateInstanceName, resource, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateInstanceInner create(String resourceGroupName, String updateInstanceName, UpdateInstanceInner resource, + Context context) { + return this.client + .getLroFinalResultOrError(beginCreate(resourceGroupName, updateInstanceName, resource, context)); + } + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String updateInstanceName, + UpdateInstanceUpdate properties) { + return updateWithResponse(resourceGroupName, updateInstanceName, properties, Context.NONE); + } + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String updateInstanceName, + UpdateInstanceUpdate properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, properties, + context); + } + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 device Update instance details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, UpdateInstanceInner> beginUpdateAsync(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, updateInstanceName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + UpdateInstanceInner.class, UpdateInstanceInner.class, this.client.getContext()); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateInstanceInner> beginUpdate(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties) { + return beginUpdate(resourceGroupName, updateInstanceName, properties, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, UpdateInstanceInner> beginUpdate(String resourceGroupName, + String updateInstanceName, UpdateInstanceUpdate properties, Context context) { + Response response = updateWithResponse(resourceGroupName, updateInstanceName, properties, context); + return this.client.getLroResult(response, UpdateInstanceInner.class, + UpdateInstanceInner.class, context); + } + + /** + * Updates update instance's patchable properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param properties Updated Update Instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String updateInstanceName, + UpdateInstanceUpdate properties) { + return beginUpdateAsync(resourceGroupName, updateInstanceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateInstanceInner update(String resourceGroupName, String updateInstanceName, + UpdateInstanceUpdate properties) { + return update(resourceGroupName, updateInstanceName, properties, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateInstanceInner update(String resourceGroupName, String updateInstanceName, + UpdateInstanceUpdate properties, Context context) { + return this.client + .getLroFinalResultOrError(beginUpdate(resourceGroupName, updateInstanceName, properties, context)); + } + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 updateInstanceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String updateInstanceName) { + return deleteWithResponse(resourceGroupName, updateInstanceName, Context.NONE); + } + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String updateInstanceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, context); + } + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 updateInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, updateInstanceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String updateInstanceName) { + return beginDelete(resourceGroupName, updateInstanceName, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String updateInstanceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, updateInstanceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 updateInstanceName) { + return beginDeleteAsync(resourceGroupName, updateInstanceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String updateInstanceName) { + delete(resourceGroupName, updateInstanceName, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String updateInstanceName, Context context) { + this.client.getLroFinalResultOrError(beginDelete(resourceGroupName, updateInstanceName, context)); + } + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance 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)); + } + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + return listByResourceGroupSinglePage(resourceGroupName, Context.NONE); + } + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return listByResourceGroup(resourceGroupName, Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Returns list of Update Instances. + * + * @throws ManagementException thrown 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 UpdateInstance list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns list of Update Instances. + * + * @throws ManagementException thrown 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 UpdateInstance list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of Update Instances. + * + * @throws ManagementException thrown 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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + return listSinglePage(Context.NONE); + } + + /** + * Returns list of Update Instances. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return list(Context.NONE); + } + + @Override + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(CheckNameAvailabilityRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkNameAvailabilitySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context); + } + + @Override + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponse(body, Context.NONE).getValue(); + } + + /** + * Preflight check for account linking readiness. No state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/preflight along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> linkPreflightWithResponseAsync(String resourceGroupName, + String updateInstanceName, LinkPreflightRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.linkPreflight(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Preflight check for account linking readiness. No state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/preflight on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkPreflightAsync(String resourceGroupName, String updateInstanceName, + LinkPreflightRequest body) { + return linkPreflightWithResponseAsync(resourceGroupName, updateInstanceName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Preflight check for account linking readiness. No state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/preflight along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response linkPreflightWithResponse(String resourceGroupName, String updateInstanceName, + LinkPreflightRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkPreflightSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, context); + } + + /** + * Preflight check for account linking readiness. No state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/preflight. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkPreflightResponse linkPreflight(String resourceGroupName, String updateInstanceName, + LinkPreflightRequest body) { + return linkPreflightWithResponse(resourceGroupName, updateInstanceName, body, Context.NONE).getValue(); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> linkInitiateWithResponseAsync(String resourceGroupName, + String updateInstanceName, LinkInitiateRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.linkInitiate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkInitiateWithResponse(String resourceGroupName, String updateInstanceName, + LinkInitiateRequest body) { + return linkInitiateWithResponse(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkInitiateWithResponse(String resourceGroupName, String updateInstanceName, + LinkInitiateRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkInitiateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, context); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginLinkInitiateAsync(String resourceGroupName, + String updateInstanceName, LinkInitiateRequest body) { + Mono>> mono + = linkInitiateWithResponseAsync(resourceGroupName, updateInstanceName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkInitiate(String resourceGroupName, String updateInstanceName, + LinkInitiateRequest body) { + return beginLinkInitiate(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkInitiate(String resourceGroupName, String updateInstanceName, + LinkInitiateRequest body, Context context) { + Response response = linkInitiateWithResponse(resourceGroupName, updateInstanceName, body, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkInitiateAsync(String resourceGroupName, String updateInstanceName, + LinkInitiateRequest body) { + return beginLinkInitiateAsync(resourceGroupName, updateInstanceName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkInitiate(String resourceGroupName, String updateInstanceName, LinkInitiateRequest body) { + linkInitiate(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Initiate account linking. Validates and persists binding, sets linkingState=InProgress. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkInitiate(String resourceGroupName, String updateInstanceName, LinkInitiateRequest body, Context context) { + this.client.getLroFinalResultOrError(beginLinkInitiate(resourceGroupName, updateInstanceName, body, context)); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> linkNotifyWithResponseAsync(String resourceGroupName, + String updateInstanceName, LinkNotifyRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.linkNotify(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkNotifyWithResponse(String resourceGroupName, String updateInstanceName, + LinkNotifyRequest body) { + return linkNotifyWithResponse(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkNotifyWithResponse(String resourceGroupName, String updateInstanceName, + LinkNotifyRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkNotifySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, context); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginLinkNotifyAsync(String resourceGroupName, String updateInstanceName, + LinkNotifyRequest body) { + Mono>> mono + = linkNotifyWithResponseAsync(resourceGroupName, updateInstanceName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkNotify(String resourceGroupName, String updateInstanceName, + LinkNotifyRequest body) { + return beginLinkNotify(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of account linking information. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkNotify(String resourceGroupName, String updateInstanceName, + LinkNotifyRequest body, Context context) { + Response response = linkNotifyWithResponse(resourceGroupName, updateInstanceName, body, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account linking information on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkNotifyAsync(String resourceGroupName, String updateInstanceName, LinkNotifyRequest body) { + return beginLinkNotifyAsync(resourceGroupName, updateInstanceName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkNotify(String resourceGroupName, String updateInstanceName, LinkNotifyRequest body) { + linkNotify(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Notify linking state change (commit, fail, or namespaceDeleted). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkNotify(String resourceGroupName, String updateInstanceName, LinkNotifyRequest body, Context context) { + this.client.getLroFinalResultOrError(beginLinkNotify(resourceGroupName, updateInstanceName, body, context)); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/update along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> linkUpdateWithResponseAsync(String resourceGroupName, + String updateInstanceName, LinkUpdateRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.linkUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/update along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkUpdateWithResponse(String resourceGroupName, String updateInstanceName, + LinkUpdateRequest body) { + return linkUpdateWithResponse(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/update along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response linkUpdateWithResponse(String resourceGroupName, String updateInstanceName, + LinkUpdateRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.linkUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, updateInstanceName, contentType, accept, body, context); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response body for /link/update. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginLinkUpdateAsync(String resourceGroupName, String updateInstanceName, + LinkUpdateRequest body) { + Mono>> mono + = linkUpdateWithResponseAsync(resourceGroupName, updateInstanceName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response body for /link/update. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkUpdate(String resourceGroupName, String updateInstanceName, + LinkUpdateRequest body) { + return beginLinkUpdate(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response body for /link/update. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginLinkUpdate(String resourceGroupName, String updateInstanceName, + LinkUpdateRequest body, Context context) { + Response response = linkUpdateWithResponse(resourceGroupName, updateInstanceName, body, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for /link/update on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkUpdateAsync(String resourceGroupName, String updateInstanceName, LinkUpdateRequest body) { + return beginLinkUpdateAsync(resourceGroupName, updateInstanceName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkUpdate(String resourceGroupName, String updateInstanceName, LinkUpdateRequest body) { + linkUpdate(resourceGroupName, updateInstanceName, body, Context.NONE); + } + + /** + * Update linking properties (e.g., identity rotation). + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void linkUpdate(String resourceGroupName, String updateInstanceName, LinkUpdateRequest body, Context context) { + this.client.getLroFinalResultOrError(beginLinkUpdate(resourceGroupName, updateInstanceName, body, 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 UpdateInstance list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + return listByResourceGroupNextSinglePage(nextLink, Context.NONE); + } + + /** + * 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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a UpdateInstance list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + return listBySubscriptionNextSinglePage(nextLink, Context.NONE); + } + + /** + * 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 UpdateInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesImpl.java new file mode 100644 index 0000000000000..8d2b8b03851b2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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.deviceregistry.softwareupdate.fluent.UpdateInstancesClient; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstances; + +public final class UpdateInstancesImpl implements UpdateInstances { + private static final ClientLogger LOGGER = new ClientLogger(UpdateInstancesImpl.class); + + private final UpdateInstancesClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager; + + public UpdateInstancesImpl(UpdateInstancesClient innerClient, + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String updateInstanceName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, updateInstanceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new UpdateInstanceImpl(inner.getValue(), this.manager())); + } + + public UpdateInstance getByResourceGroup(String resourceGroupName, String updateInstanceName) { + UpdateInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, updateInstanceName); + if (inner != null) { + return new UpdateInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String updateInstanceName) { + this.delete(resourceGroupName, updateInstanceName, Context.NONE); + } + + public void delete(String resourceGroupName, String updateInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, updateInstanceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + return this.listByResourceGroup(resourceGroupName, Context.NONE); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new UpdateInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + return this.list(Context.NONE); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new UpdateInstanceImpl(inner1, this.manager())); + } + + public Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } + + public CheckNameAvailabilityResult checkNameAvailability(CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResultInner inner = this.serviceClient().checkNameAvailability(body); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateInstance getById(String id) { + return this.getByIdWithResponse(id, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "resourceGroupName", "resourceGroups", LOGGER); + String updateInstanceName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "updateInstanceName", "updateInstances", LOGGER); + return this.getByResourceGroupWithResponse(resourceGroupName, updateInstanceName, context); + } + + public void deleteById(String id) { + this.deleteByIdWithResponse(id, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "resourceGroupName", "resourceGroups", LOGGER); + String updateInstanceName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/updateInstances/{updateInstanceName}", + "updateInstanceName", "updateInstances", LOGGER); + this.delete(resourceGroupName, updateInstanceName, context); + } + + private UpdateInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager() { + return this.serviceManager; + } + + public UpdateInstanceImpl define(String name) { + return new UpdateInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/InboundCallerIdentity.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/InboundCallerIdentity.java new file mode 100644 index 0000000000000..8905473a37306 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/InboundCallerIdentity.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.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.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import java.io.IOException; + +/** + * Identity information for inbound calls from Azure Device Registry. + */ +@Fluent +public final class InboundCallerIdentity implements JsonSerializable { + /* + * The type of managed identity. + */ + private ManagedServiceIdentityType type; + + /* + * ARM resource ID of the user-assigned managed identity. Required when type is "UserAssigned". + */ + private String userAssignedIdentity; + + /** + * Creates an instance of InboundCallerIdentity class. + */ + public InboundCallerIdentity() { + } + + /** + * Get the type property: The type of managed identity. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity. + * + * @param type the type value to set. + * @return the InboundCallerIdentity object itself. + */ + public InboundCallerIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentity property: ARM resource ID of the user-assigned managed identity. Required when type + * is "UserAssigned". + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: ARM resource ID of the user-assigned managed identity. Required when type + * is "UserAssigned". + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the InboundCallerIdentity object itself. + */ + public InboundCallerIdentity withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("userAssignedIdentity", this.userAssignedIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InboundCallerIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InboundCallerIdentity 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 InboundCallerIdentity. + */ + public static InboundCallerIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InboundCallerIdentity deserializedInboundCallerIdentity = new InboundCallerIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedInboundCallerIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentity".equals(fieldName)) { + deserializedInboundCallerIdentity.userAssignedIdentity = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInboundCallerIdentity; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkInitiateRequest.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkInitiateRequest.java new file mode 100644 index 0000000000000..8304291832247 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkInitiateRequest.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.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; + +/** + * Request body for /link/initiate. + */ +@Fluent +public final class LinkInitiateRequest implements JsonSerializable { + /* + * ARM resource ID of the namespace. + */ + private String namespaceResourceId; + + /* + * Globally unique namespace identifier for backend operations. + */ + private String namespaceUuid; + + /* + * Data-plane address of the ADR namespace. + */ + private String dataAddress; + + /* + * Managed Identity the resource should use for ADR communication. + */ + private InboundCallerIdentity inboundCallerIdentity; + + /** + * Creates an instance of LinkInitiateRequest class. + */ + public LinkInitiateRequest() { + } + + /** + * Get the namespaceResourceId property: ARM resource ID of the namespace. + * + * @return the namespaceResourceId value. + */ + public String namespaceResourceId() { + return this.namespaceResourceId; + } + + /** + * Set the namespaceResourceId property: ARM resource ID of the namespace. + * + * @param namespaceResourceId the namespaceResourceId value to set. + * @return the LinkInitiateRequest object itself. + */ + public LinkInitiateRequest withNamespaceResourceId(String namespaceResourceId) { + this.namespaceResourceId = namespaceResourceId; + return this; + } + + /** + * Get the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @return the namespaceUuid value. + */ + public String namespaceUuid() { + return this.namespaceUuid; + } + + /** + * Set the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @param namespaceUuid the namespaceUuid value to set. + * @return the LinkInitiateRequest object itself. + */ + public LinkInitiateRequest withNamespaceUuid(String namespaceUuid) { + this.namespaceUuid = namespaceUuid; + return this; + } + + /** + * Get the dataAddress property: Data-plane address of the ADR namespace. + * + * @return the dataAddress value. + */ + public String dataAddress() { + return this.dataAddress; + } + + /** + * Set the dataAddress property: Data-plane address of the ADR namespace. + * + * @param dataAddress the dataAddress value to set. + * @return the LinkInitiateRequest object itself. + */ + public LinkInitiateRequest withDataAddress(String dataAddress) { + this.dataAddress = dataAddress; + return this; + } + + /** + * Get the inboundCallerIdentity property: Managed Identity the resource should use for ADR communication. + * + * @return the inboundCallerIdentity value. + */ + public InboundCallerIdentity inboundCallerIdentity() { + return this.inboundCallerIdentity; + } + + /** + * Set the inboundCallerIdentity property: Managed Identity the resource should use for ADR communication. + * + * @param inboundCallerIdentity the inboundCallerIdentity value to set. + * @return the LinkInitiateRequest object itself. + */ + public LinkInitiateRequest withInboundCallerIdentity(InboundCallerIdentity inboundCallerIdentity) { + this.inboundCallerIdentity = inboundCallerIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("namespaceResourceId", this.namespaceResourceId); + jsonWriter.writeStringField("namespaceUuid", this.namespaceUuid); + jsonWriter.writeStringField("dataAddress", this.dataAddress); + jsonWriter.writeJsonField("inboundCallerIdentity", this.inboundCallerIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkInitiateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkInitiateRequest 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 LinkInitiateRequest. + */ + public static LinkInitiateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkInitiateRequest deserializedLinkInitiateRequest = new LinkInitiateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("namespaceResourceId".equals(fieldName)) { + deserializedLinkInitiateRequest.namespaceResourceId = reader.getString(); + } else if ("namespaceUuid".equals(fieldName)) { + deserializedLinkInitiateRequest.namespaceUuid = reader.getString(); + } else if ("dataAddress".equals(fieldName)) { + deserializedLinkInitiateRequest.dataAddress = reader.getString(); + } else if ("inboundCallerIdentity".equals(fieldName)) { + deserializedLinkInitiateRequest.inboundCallerIdentity = InboundCallerIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkInitiateRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyAction.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyAction.java new file mode 100644 index 0000000000000..d32b8f90df08e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyAction.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Link notify action type. + */ +public final class LinkNotifyAction extends ExpandableStringEnum { + /** + * Commit the linking operation (InProgress → Succeeded). Resource starts + * linked behavior. + */ + public static final LinkNotifyAction COMMIT = fromString("commit"); + + /** + * Report that the linking operation failed. + */ + public static final LinkNotifyAction FAIL = fromString("fail"); + + /** + * The linked namespace was deleted (Succeeded → Orphaned). Terminal. Resource enters an + * unusable state: devices are wiped, linked behavior stops, no re-link allowed. + */ + public static final LinkNotifyAction NAMESPACE_DELETED = fromString("namespaceDeleted"); + + /** + * Creates a new instance of LinkNotifyAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinkNotifyAction() { + } + + /** + * Creates or finds a LinkNotifyAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinkNotifyAction. + */ + public static LinkNotifyAction fromString(String name) { + return fromString(name, LinkNotifyAction.class); + } + + /** + * Gets known LinkNotifyAction values. + * + * @return known LinkNotifyAction values. + */ + public static Collection values() { + return values(LinkNotifyAction.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyRequest.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyRequest.java new file mode 100644 index 0000000000000..78914acf5bcc1 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyRequest.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.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; + +/** + * Request body for /link/notify. Idempotent: a duplicate notification matching the + * resource's current linkingState returns 200 with no further state change, making + * it safe for ADR to retry after transient failures. + */ +@Fluent +public final class LinkNotifyRequest implements JsonSerializable { + /* + * The action to perform on the linking state. + */ + private LinkNotifyAction action; + + /* + * Error code describing the failure. Required when action is "fail"; ignored otherwise. + * Tracked on ADR's LRO for diagnostics. + */ + private String errorCode; + + /* + * Human-readable reason for the failure. Required when action is "fail"; ignored otherwise. + * Tracked on ADR's LRO for diagnostics. + */ + private String reason; + + /** + * Creates an instance of LinkNotifyRequest class. + */ + public LinkNotifyRequest() { + } + + /** + * Get the action property: The action to perform on the linking state. + * + * @return the action value. + */ + public LinkNotifyAction action() { + return this.action; + } + + /** + * Set the action property: The action to perform on the linking state. + * + * @param action the action value to set. + * @return the LinkNotifyRequest object itself. + */ + public LinkNotifyRequest withAction(LinkNotifyAction action) { + this.action = action; + return this; + } + + /** + * Get the errorCode property: Error code describing the failure. Required when action is "fail"; ignored otherwise. + * Tracked on ADR's LRO for diagnostics. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: Error code describing the failure. Required when action is "fail"; ignored otherwise. + * Tracked on ADR's LRO for diagnostics. + * + * @param errorCode the errorCode value to set. + * @return the LinkNotifyRequest object itself. + */ + public LinkNotifyRequest withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the reason property: Human-readable reason for the failure. Required when action is "fail"; ignored + * otherwise. + * Tracked on ADR's LRO for diagnostics. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Human-readable reason for the failure. Required when action is "fail"; ignored + * otherwise. + * Tracked on ADR's LRO for diagnostics. + * + * @param reason the reason value to set. + * @return the LinkNotifyRequest object itself. + */ + public LinkNotifyRequest withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("action", this.action == null ? null : this.action.toString()); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("reason", this.reason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkNotifyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkNotifyRequest 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 LinkNotifyRequest. + */ + public static LinkNotifyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkNotifyRequest deserializedLinkNotifyRequest = new LinkNotifyRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("action".equals(fieldName)) { + deserializedLinkNotifyRequest.action = LinkNotifyAction.fromString(reader.getString()); + } else if ("errorCode".equals(fieldName)) { + deserializedLinkNotifyRequest.errorCode = reader.getString(); + } else if ("reason".equals(fieldName)) { + deserializedLinkNotifyRequest.reason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkNotifyRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightRequest.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightRequest.java new file mode 100644 index 0000000000000..246e00b017239 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightRequest.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.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; + +/** + * Request body for /link/preflight. + */ +@Fluent +public final class LinkPreflightRequest implements JsonSerializable { + /* + * ARM resource ID of the namespace. Resource stores this for ARM property visibility and optional best-effort + * deletion notification. + */ + private String namespaceResourceId; + + /* + * Globally unique namespace identifier for backend operations. + */ + private String namespaceUuid; + + /* + * Managed Identity the resource should use for ADR communication. + */ + private InboundCallerIdentity inboundCallerIdentity; + + /** + * Creates an instance of LinkPreflightRequest class. + */ + public LinkPreflightRequest() { + } + + /** + * Get the namespaceResourceId property: ARM resource ID of the namespace. Resource stores this for ARM property + * visibility and optional best-effort deletion notification. + * + * @return the namespaceResourceId value. + */ + public String namespaceResourceId() { + return this.namespaceResourceId; + } + + /** + * Set the namespaceResourceId property: ARM resource ID of the namespace. Resource stores this for ARM property + * visibility and optional best-effort deletion notification. + * + * @param namespaceResourceId the namespaceResourceId value to set. + * @return the LinkPreflightRequest object itself. + */ + public LinkPreflightRequest withNamespaceResourceId(String namespaceResourceId) { + this.namespaceResourceId = namespaceResourceId; + return this; + } + + /** + * Get the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @return the namespaceUuid value. + */ + public String namespaceUuid() { + return this.namespaceUuid; + } + + /** + * Set the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @param namespaceUuid the namespaceUuid value to set. + * @return the LinkPreflightRequest object itself. + */ + public LinkPreflightRequest withNamespaceUuid(String namespaceUuid) { + this.namespaceUuid = namespaceUuid; + return this; + } + + /** + * Get the inboundCallerIdentity property: Managed Identity the resource should use for ADR communication. + * + * @return the inboundCallerIdentity value. + */ + public InboundCallerIdentity inboundCallerIdentity() { + return this.inboundCallerIdentity; + } + + /** + * Set the inboundCallerIdentity property: Managed Identity the resource should use for ADR communication. + * + * @param inboundCallerIdentity the inboundCallerIdentity value to set. + * @return the LinkPreflightRequest object itself. + */ + public LinkPreflightRequest withInboundCallerIdentity(InboundCallerIdentity inboundCallerIdentity) { + this.inboundCallerIdentity = inboundCallerIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("namespaceResourceId", this.namespaceResourceId); + jsonWriter.writeStringField("namespaceUuid", this.namespaceUuid); + jsonWriter.writeJsonField("inboundCallerIdentity", this.inboundCallerIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkPreflightRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkPreflightRequest 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 LinkPreflightRequest. + */ + public static LinkPreflightRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkPreflightRequest deserializedLinkPreflightRequest = new LinkPreflightRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("namespaceResourceId".equals(fieldName)) { + deserializedLinkPreflightRequest.namespaceResourceId = reader.getString(); + } else if ("namespaceUuid".equals(fieldName)) { + deserializedLinkPreflightRequest.namespaceUuid = reader.getString(); + } else if ("inboundCallerIdentity".equals(fieldName)) { + deserializedLinkPreflightRequest.inboundCallerIdentity = InboundCallerIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkPreflightRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightResponse.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightResponse.java new file mode 100644 index 0000000000000..dfbb13d2fe48e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightResponse.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +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; + +/** + * Response body for /link/preflight. + */ +@Immutable +public final class LinkPreflightResponse implements JsonSerializable { + /* + * Ready if all readiness checks pass, NotReady if any blocking error exists. + */ + private LinkPreflightStatus status; + + /* + * Array of blocking conditions when status is NotReady. + */ + private List errors; + + /* + * Array of non-blocking conditions ADR surfaces to the customer (e.g., edge/module presence per C3). May appear + * with either Ready or NotReady. + */ + private List warnings; + + /* + * Resource-defined sub-object for resource-internal data not available via ARM GET. + */ + private LinkedResourceMetadata metadata; + + /** + * Creates an instance of LinkPreflightResponse class. + */ + private LinkPreflightResponse() { + } + + /** + * Get the status property: Ready if all readiness checks pass, NotReady if any blocking error exists. + * + * @return the status value. + */ + public LinkPreflightStatus status() { + return this.status; + } + + /** + * Get the errors property: Array of blocking conditions when status is NotReady. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Get the warnings property: Array of non-blocking conditions ADR surfaces to the customer (e.g., edge/module + * presence per C3). May appear with either Ready or NotReady. + * + * @return the warnings value. + */ + public List warnings() { + return this.warnings; + } + + /** + * Get the metadata property: Resource-defined sub-object for resource-internal data not available via ARM GET. + * + * @return the metadata value. + */ + public LinkedResourceMetadata metadata() { + return this.metadata; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("warnings", this.warnings, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("metadata", this.metadata); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkPreflightResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkPreflightResponse 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 LinkPreflightResponse. + */ + public static LinkPreflightResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkPreflightResponse deserializedLinkPreflightResponse = new LinkPreflightResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedLinkPreflightResponse.status = LinkPreflightStatus.fromString(reader.getString()); + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); + deserializedLinkPreflightResponse.errors = errors; + } else if ("warnings".equals(fieldName)) { + List warnings = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); + deserializedLinkPreflightResponse.warnings = warnings; + } else if ("metadata".equals(fieldName)) { + deserializedLinkPreflightResponse.metadata = LinkedResourceMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkPreflightResponse; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightStatus.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightStatus.java new file mode 100644 index 0000000000000..3e3cbfe747dd6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Readiness status for preflight check. + */ +public final class LinkPreflightStatus extends ExpandableStringEnum { + /** + * All readiness checks pass. + */ + public static final LinkPreflightStatus READY = fromString("Ready"); + + /** + * One or more blocking errors exist. + */ + public static final LinkPreflightStatus NOT_READY = fromString("NotReady"); + + /** + * Creates a new instance of LinkPreflightStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinkPreflightStatus() { + } + + /** + * Creates or finds a LinkPreflightStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinkPreflightStatus. + */ + public static LinkPreflightStatus fromString(String name) { + return fromString(name, LinkPreflightStatus.class); + } + + /** + * Gets known LinkPreflightStatus values. + * + * @return known LinkPreflightStatus values. + */ + public static Collection values() { + return values(LinkPreflightStatus.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkUpdateRequest.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkUpdateRequest.java new file mode 100644 index 0000000000000..ebb03ebe77aa0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkUpdateRequest.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.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; + +/** + * Request body for /link/update. Acts as a PATCH — only provided properties are applied. + */ +@Fluent +public final class LinkUpdateRequest implements JsonSerializable { + /* + * ARM resource ID of the namespace. + */ + private String namespaceResourceId; + + /* + * Globally unique namespace identifier for backend operations. + */ + private String namespaceUuid; + + /* + * ADR data-plane address for the namespace. Resource uses this for post-link runtime communication (device sync, + * provisioning). + */ + private String dataAddress; + + /* + * User or Managed Identity for inbound calls from Azure Device Registry. + */ + private InboundCallerIdentity inboundCallerIdentity; + + /** + * Creates an instance of LinkUpdateRequest class. + */ + public LinkUpdateRequest() { + } + + /** + * Get the namespaceResourceId property: ARM resource ID of the namespace. + * + * @return the namespaceResourceId value. + */ + public String namespaceResourceId() { + return this.namespaceResourceId; + } + + /** + * Set the namespaceResourceId property: ARM resource ID of the namespace. + * + * @param namespaceResourceId the namespaceResourceId value to set. + * @return the LinkUpdateRequest object itself. + */ + public LinkUpdateRequest withNamespaceResourceId(String namespaceResourceId) { + this.namespaceResourceId = namespaceResourceId; + return this; + } + + /** + * Get the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @return the namespaceUuid value. + */ + public String namespaceUuid() { + return this.namespaceUuid; + } + + /** + * Set the namespaceUuid property: Globally unique namespace identifier for backend operations. + * + * @param namespaceUuid the namespaceUuid value to set. + * @return the LinkUpdateRequest object itself. + */ + public LinkUpdateRequest withNamespaceUuid(String namespaceUuid) { + this.namespaceUuid = namespaceUuid; + return this; + } + + /** + * Get the dataAddress property: ADR data-plane address for the namespace. Resource uses this for post-link runtime + * communication (device sync, provisioning). + * + * @return the dataAddress value. + */ + public String dataAddress() { + return this.dataAddress; + } + + /** + * Set the dataAddress property: ADR data-plane address for the namespace. Resource uses this for post-link runtime + * communication (device sync, provisioning). + * + * @param dataAddress the dataAddress value to set. + * @return the LinkUpdateRequest object itself. + */ + public LinkUpdateRequest withDataAddress(String dataAddress) { + this.dataAddress = dataAddress; + return this; + } + + /** + * Get the inboundCallerIdentity property: User or Managed Identity for inbound calls from Azure Device Registry. + * + * @return the inboundCallerIdentity value. + */ + public InboundCallerIdentity inboundCallerIdentity() { + return this.inboundCallerIdentity; + } + + /** + * Set the inboundCallerIdentity property: User or Managed Identity for inbound calls from Azure Device Registry. + * + * @param inboundCallerIdentity the inboundCallerIdentity value to set. + * @return the LinkUpdateRequest object itself. + */ + public LinkUpdateRequest withInboundCallerIdentity(InboundCallerIdentity inboundCallerIdentity) { + this.inboundCallerIdentity = inboundCallerIdentity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("namespaceResourceId", this.namespaceResourceId); + jsonWriter.writeStringField("namespaceUuid", this.namespaceUuid); + jsonWriter.writeStringField("dataAddress", this.dataAddress); + jsonWriter.writeJsonField("inboundCallerIdentity", this.inboundCallerIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkUpdateRequest 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 LinkUpdateRequest. + */ + public static LinkUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkUpdateRequest deserializedLinkUpdateRequest = new LinkUpdateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("namespaceResourceId".equals(fieldName)) { + deserializedLinkUpdateRequest.namespaceResourceId = reader.getString(); + } else if ("namespaceUuid".equals(fieldName)) { + deserializedLinkUpdateRequest.namespaceUuid = reader.getString(); + } else if ("dataAddress".equals(fieldName)) { + deserializedLinkUpdateRequest.dataAddress = reader.getString(); + } else if ("inboundCallerIdentity".equals(fieldName)) { + deserializedLinkUpdateRequest.inboundCallerIdentity = InboundCallerIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkUpdateRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkedResourceMetadata.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkedResourceMetadata.java new file mode 100644 index 0000000000000..732178cea8a32 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkedResourceMetadata.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Metadata returned by the preflight check. + */ +@Immutable +public final class LinkedResourceMetadata implements JsonSerializable { + /* + * Total number of devices in the hub. + */ + private Integer deviceCount; + + /** + * Creates an instance of LinkedResourceMetadata class. + */ + private LinkedResourceMetadata() { + } + + /** + * Get the deviceCount property: Total number of devices in the hub. + * + * @return the deviceCount value. + */ + public Integer deviceCount() { + return this.deviceCount; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("deviceCount", this.deviceCount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkedResourceMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkedResourceMetadata 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 LinkedResourceMetadata. + */ + public static LinkedResourceMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkedResourceMetadata deserializedLinkedResourceMetadata = new LinkedResourceMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceCount".equals(fieldName)) { + deserializedLinkedResourceMetadata.deviceCount = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkedResourceMetadata; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/OperationListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/OperationListResult.java new file mode 100644 index 0000000000000..b6f63a14f1756 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/UpdateInstanceListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/UpdateInstanceListResult.java new file mode 100644 index 0000000000000..b3dd5dcd675d4 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/UpdateInstanceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a UpdateInstance list operation. + */ +@Immutable +public final class UpdateInstanceListResult implements JsonSerializable { + /* + * The UpdateInstance items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of UpdateInstanceListResult class. + */ + private UpdateInstanceListResult() { + } + + /** + * Get the value property: The UpdateInstance items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateInstanceListResult 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 UpdateInstanceListResult. + */ + public static UpdateInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateInstanceListResult deserializedUpdateInstanceListResult = new UpdateInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> UpdateInstanceInner.fromJson(reader1)); + deserializedUpdateInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedUpdateInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateInstanceListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/package-info.java new file mode 100644 index 0000000000000..6c0304f3d9158 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/package-info.java new file mode 100644 index 0000000000000..03158db0bebc4 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate.implementation; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinking.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinking.java new file mode 100644 index 0000000000000..9a5115c0766d7 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinking.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner; + +/** + * An immutable client-side representation of AccountLinking. + */ +public interface AccountLinking { + /** + * Gets the namespaceResourceId property: The ARM resource ID of the linked Azure Device Registry namespace. + * + * @return the namespaceResourceId value. + */ + String namespaceResourceId(); + + /** + * Gets the linkingState property: The current linking state. Absent before any link attempt (logical NotLinked + * state). + * See AccountLinkingState for the full state machine and transition rules. + * + * @return the linkingState value. + */ + AccountLinkingState linkingState(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner object. + * + * @return the inner object. + */ + AccountLinkingInner innerModel(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinkingState.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinkingState.java new file mode 100644 index 0000000000000..6100f1a69536c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinkingState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Account linking state. + * + * Tracks the relationship between a linkable resource and an ADR namespace. + * The property is absent before any link attempt; its presence indicates a link + * has been initiated. NotLinked is a logical initial state, not a persisted value. + */ +public final class AccountLinkingState extends ExpandableStringEnum { + /** + * Link in progress. + */ + public static final AccountLinkingState IN_PROGRESS = fromString("InProgress"); + + /** + * Successfully linked to a namespace. + */ + public static final AccountLinkingState SUCCEEDED = fromString("Succeeded"); + + /** + * Was linked; namespace was deleted. ADR sent namespaceDeleted. Terminal state — no + * re-link is allowed. The resource is not auto-deleted; the customer must explicitly delete it. + */ + public static final AccountLinkingState ORPHANED = fromString("Orphaned"); + + /** + * Creates a new instance of AccountLinkingState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountLinkingState() { + } + + /** + * Creates or finds a AccountLinkingState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountLinkingState. + */ + public static AccountLinkingState fromString(String name) { + return fromString(name, AccountLinkingState.class); + } + + /** + * Gets known AccountLinkingState values. + * + * @return known AccountLinkingState values. + */ + public static Collection values() { + return values(AccountLinkingState.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ActionType.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ActionType.java new file mode 100644 index 0000000000000..d2cb9ff5004d9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityReason.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..614c42c089108 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityReason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible reasons for a name not being available. + */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** + * Name is invalid. + */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Name already exists. + */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityRequest.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..d83da98c9bab4 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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 check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest implements JsonSerializable { + /* + * The name of the resource for which availability needs to be checked. + */ + private String name; + + /* + * The resource type. + */ + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest 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 CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..bcf24df1d5baa --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityResult.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner + * com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentity.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..39dd937706a7e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentityType.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..0b7ebda298ba8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operation.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operation.java new file mode 100644 index 0000000000000..1f6fef07b3b1d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/OperationDisplay.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/OperationDisplay.java new file mode 100644 index 0000000000000..1932a9f828d32 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operations.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operations.java new file mode 100644 index 0000000000000..1d0cc66c552f7 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Origin.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Origin.java new file mode 100644 index 0000000000000..0f8a846d3ad5c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ProvisioningState.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ProvisioningState.java new file mode 100644 index 0000000000000..b2354c745272c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Provisioning State Accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Provisioning State Creating. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Provisioning State Deleting. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * 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/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstance.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstance.java new file mode 100644 index 0000000000000..4fac5fcf7c974 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstance.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import java.util.Map; + +/** + * An immutable client-side representation of UpdateInstance. + */ +public interface UpdateInstance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + UpdateInstanceProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner object. + * + * @return the inner object. + */ + UpdateInstanceInner innerModel(); + + /** + * The entirety of the UpdateInstance definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The UpdateInstance definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the UpdateInstance definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the UpdateInstance 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 UpdateInstance 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 UpdateInstance definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + UpdateInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + UpdateInstance create(Context context); + } + + /** + * The stage of the UpdateInstance 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 UpdateInstance definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(UpdateInstancePropertiesInner properties); + } + + /** + * The stage of the UpdateInstance definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the UpdateInstance resource. + * + * @return the stage of resource update. + */ + UpdateInstance.Update update(); + + /** + * The template for UpdateInstance update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + UpdateInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + UpdateInstance apply(Context context); + } + + /** + * The UpdateInstance update stages. + */ + interface UpdateStages { + /** + * The stage of the UpdateInstance update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: List of key value pairs that describe the resource. This will overwrite the + * existing tags.. + * + * @param tags List of key value pairs that describe the resource. This will overwrite the existing tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the UpdateInstance update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The type of identity used for the resource.. + * + * @param identity The type of identity used for the resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + UpdateInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + UpdateInstance refresh(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceProperties.java new file mode 100644 index 0000000000000..697f092dc1469 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceProperties.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; + +/** + * An immutable client-side representation of UpdateInstanceProperties. + */ +public interface UpdateInstanceProperties { + /** + * Gets the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the serviceAddress property: Service-facing address for ADR→ADU communication. + * + * @return the serviceAddress value. + */ + String serviceAddress(); + + /** + * Gets the linking property: Account linking state. Absent until first /link/initiate. + * + * @return the linking value. + */ + AccountLinking linking(); + + /** + * Gets the inner + * com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner object. + * + * @return the inner object. + */ + UpdateInstancePropertiesInner innerModel(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceUpdate.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceUpdate.java new file mode 100644 index 0000000000000..b4139bf257d5a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceUpdate.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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; + +/** + * Request payload used to update an existing Update Instance. + */ +@Fluent +public final class UpdateInstanceUpdate implements JsonSerializable { + /* + * List of key value pairs that describe the resource. This will overwrite the existing tags. + */ + private Map tags; + + /* + * The type of identity used for the resource. + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of UpdateInstanceUpdate class. + */ + public UpdateInstanceUpdate() { + } + + /** + * Get the tags property: List of key value pairs that describe the resource. This will overwrite the existing tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: List of key value pairs that describe the resource. This will overwrite the existing tags. + * + * @param tags the tags value to set. + * @return the UpdateInstanceUpdate object itself. + */ + public UpdateInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The type of identity used for the resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The type of identity used for the resource. + * + * @param identity the identity value to set. + * @return the UpdateInstanceUpdate object itself. + */ + public UpdateInstanceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@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); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateInstanceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateInstanceUpdate 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 UpdateInstanceUpdate. + */ + public static UpdateInstanceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateInstanceUpdate deserializedUpdateInstanceUpdate = new UpdateInstanceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedUpdateInstanceUpdate.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedUpdateInstanceUpdate.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateInstanceUpdate; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstances.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstances.java new file mode 100644 index 0000000000000..052c6dd3deb42 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstances.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.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 UpdateInstances. + */ +public interface UpdateInstances { + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String updateInstanceName, + Context context); + + /** + * Returns update instance details for the given update instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return device Update instance details. + */ + UpdateInstance getByResourceGroup(String resourceGroupName, String updateInstanceName); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 updateInstanceName); + + /** + * Deletes an update instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param updateInstanceName The user-chosen Update Instance name. Must be unique within the subscription and is + * used in the resource URL and ADU service routing. Allowed characters: alphanumeric and hyphens (not + * leading/trailing); length 3-36. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 updateInstanceName, Context context); + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns list of Update Instances. + * + * @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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns list of Update Instances. + * + * @throws com.azure.core.management.exception.ManagementException thrown 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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Returns list of Update Instances. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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 UpdateInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context); + + /** + * Check if the Update Instance name is available. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + CheckNameAvailabilityResult checkNameAvailability(CheckNameAvailabilityRequest body); + + /** + * Returns update instance details for the given update instance name. + * + * @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 device Update instance details along with {@link Response}. + */ + UpdateInstance getById(String id); + + /** + * Returns update instance details for the given update instance name. + * + * @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 device Update instance details along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an update instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an update instance. + * + * @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 UpdateInstance resource. + * + * @param name resource name. + * @return the first stage of the new UpdateInstance definition. + */ + UpdateInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UserAssignedIdentity.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..1895a81556634 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/package-info.java new file mode 100644 index 0000000000000..f364103de6ba8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate.models; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/package-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/package-info.java new file mode 100644 index 0000000000000..fcd722b3e2ccf --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for DeviceRegistrySoftwareUpdate. + * Microsoft Device Update resource provider. + */ +package com.azure.resourcemanager.deviceregistry.softwareupdate; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/module-info.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/module-info.java new file mode 100644 index 0000000000000..f11eb98f69a8d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.deviceregistry.softwareupdate { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.deviceregistry.softwareupdate; + exports com.azure.resourcemanager.deviceregistry.softwareupdate.fluent; + exports com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models; + exports com.azure.resourcemanager.deviceregistry.softwareupdate.models; + + opens com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models to com.azure.core; + opens com.azure.resourcemanager.deviceregistry.softwareupdate.models to com.azure.core; + opens com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models to com.azure.core; +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-resourcemanager-deviceregistry-softwareupdate_metadata.json b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-resourcemanager-deviceregistry-softwareupdate_metadata.json new file mode 100644 index 0000000000000..649fc6ae2f48f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/azure-resourcemanager-deviceregistry-softwareupdate_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.DeviceUpdate":"2026-11-02-preview"},"crossLanguagePackageId":"Microsoft.DeviceUpdate","crossLanguageVersion":"123e0b1ebe21","crossLanguageDefinitions":{"com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.DeviceRegistrySoftwareUpdateManagementClient":"Microsoft.DeviceUpdate","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.OperationsClient":"Microsoft.DeviceUpdate.Operations","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient":"Microsoft.DeviceUpdate.UpdateInstances","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.beginCreate":"Microsoft.DeviceUpdate.UpdateInstances.create","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.beginDelete":"Microsoft.DeviceUpdate.UpdateInstances.delete","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.beginUpdate":"Microsoft.DeviceUpdate.UpdateInstances.update","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.checkNameAvailability":"Microsoft.DeviceUpdate.UpdateInstances.checkNameAvailability","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.checkNameAvailabilityWithResponse":"Microsoft.DeviceUpdate.UpdateInstances.checkNameAvailability","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.create":"Microsoft.DeviceUpdate.UpdateInstances.create","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.delete":"Microsoft.DeviceUpdate.UpdateInstances.delete","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.getByResourceGroup":"Microsoft.DeviceUpdate.UpdateInstances.get","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.getByResourceGroupWithResponse":"Microsoft.DeviceUpdate.UpdateInstances.get","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.list":"Microsoft.DeviceUpdate.UpdateInstances.listBySubscription","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.listByResourceGroup":"Microsoft.DeviceUpdate.UpdateInstances.listByResourceGroup","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.UpdateInstancesClient.update":"Microsoft.DeviceUpdate.UpdateInstances.update","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner":"Microsoft.DeviceUpdate.AccountLinking","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner":"Microsoft.DeviceUpdate.UpdateInstance","com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner":"Microsoft.DeviceUpdate.UpdateInstanceProperties","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.DeviceRegistrySoftwareUpdateManagementClientBuilder":"Microsoft.DeviceUpdate","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.InboundCallerIdentity":"Microsoft.DeviceUpdate.InboundCallerIdentity","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkInitiateRequest":"Microsoft.DeviceUpdate.LinkInitiateRequest","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkNotifyAction":"Microsoft.DeviceUpdate.LinkNotifyAction","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkNotifyRequest":"Microsoft.DeviceUpdate.LinkNotifyRequest","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightRequest":"Microsoft.DeviceUpdate.LinkPreflightRequest","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightResponse":"Microsoft.DeviceUpdate.LinkPreflightResponse","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightStatus":"Microsoft.DeviceUpdate.LinkPreflightStatus","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkUpdateRequest":"Microsoft.DeviceUpdate.LinkUpdateRequest","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkedResourceMetadata":"Microsoft.DeviceUpdate.LinkedResourceMetadata","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.UpdateInstanceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.deviceregistry.softwareupdate.models.AccountLinkingState":"Microsoft.DeviceUpdate.AccountLinkingState","com.azure.resourcemanager.deviceregistry.softwareupdate.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityReason":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason","com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest","com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.deviceregistry.softwareupdate.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.deviceregistry.softwareupdate.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.deviceregistry.softwareupdate.models.ProvisioningState":"Microsoft.DeviceUpdate.ProvisioningState","com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceUpdate":"Microsoft.DeviceUpdate.UpdateInstanceUpdate","com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/DeviceRegistrySoftwareUpdateManager.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/DeviceRegistrySoftwareUpdateManagementClient.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/UpdateInstancesClient.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/AccountLinkingInner.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/CheckNameAvailabilityResultInner.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstanceInner.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/UpdateInstancePropertiesInner.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/fluent/package-info.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/AccountLinkingImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/CheckNameAvailabilityResultImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/DeviceRegistrySoftwareUpdateManagementClientImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstanceImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancePropertiesImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesClientImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/UpdateInstancesImpl.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/InboundCallerIdentity.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkInitiateRequest.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyAction.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkNotifyRequest.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightRequest.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightResponse.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkPreflightStatus.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkUpdateRequest.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/LinkedResourceMetadata.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/UpdateInstanceListResult.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/models/package-info.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/implementation/package-info.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinking.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/AccountLinkingState.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ActionType.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityReason.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityRequest.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/CheckNameAvailabilityResult.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentity.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ManagedServiceIdentityType.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operation.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Operations.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/Origin.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstance.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceProperties.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstanceUpdate.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UpdateInstances.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/models/package-info.java","src/main/java/com/azure/resourcemanager/deviceregistry/softwareupdate/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/proxy-config.json b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/proxy-config.json new file mode 100644 index 0000000000000..c3e0680461549 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.UpdateInstancesClientImpl$UpdateInstancesService"]] \ No newline at end of file diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/reflect-config.json b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry-softwareupdate/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/azure-resourcemanager-deviceregistry-softwareupdate.properties b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/azure-resourcemanager-deviceregistry-softwareupdate.properties new file mode 100644 index 0000000000000..defbd48204e47 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/main/resources/azure-resourcemanager-deviceregistry-softwareupdate.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..9c3735f1c239e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-11-02-preview/Operations_List.json + */ + /** + * Sample code: Gets the list of operations. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsTheListOfOperations( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilitySamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..481b556fa2bab --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilitySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; + +/** + * Samples for UpdateInstances CheckNameAvailability. + */ +public final class UpdateInstancesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_CheckNameAvailability.json + */ + /** + * Sample code: Check Update Instance name availability. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void checkUpdateInstanceNameAvailability( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("contoso") + .withType("Microsoft.DeviceUpdate/updateInstances"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateSamples.java new file mode 100644 index 0000000000000..2f03c6536fd18 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for UpdateInstances Create. + */ +public final class UpdateInstancesCreateSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Create.json + */ + /** + * Sample code: Creates or updates an Update Instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void createsOrUpdatesAnUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .define("contoso") + .withRegion("eastus2") + .withExistingResourceGroup("test-rg") + .withTags(mapOf("env", "prod")) + .withProperties(new UpdateInstancePropertiesInner()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-mi", + new UserAssignedIdentity()))) + .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/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesDeleteSamples.java new file mode 100644 index 0000000000000..b866f8912877a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +/** + * Samples for UpdateInstances Delete. + */ +public final class UpdateInstancesDeleteSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Delete.json + */ + /** + * Sample code: Deletes an update instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void deletesAnUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().delete("test-rg", "contoso", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..691e3e9678906 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +/** + * Samples for UpdateInstances GetByResourceGroup. + */ +public final class UpdateInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Get.json + */ + /** + * Sample code: Gets Update Instance details. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsUpdateInstanceDetails( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances() + .getByResourceGroupWithResponse("test-rg", "contoso", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..586eda738a6af --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +/** + * Samples for UpdateInstances ListByResourceGroup. + */ +public final class UpdateInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_ListByResourceGroup.json + */ + /** + * Sample code: Gets list of Update Instances. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsListOfUpdateInstances( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListSamples.java new file mode 100644 index 0000000000000..a1e883f9f75e6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +/** + * Samples for UpdateInstances List. + */ +public final class UpdateInstancesListSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_ListBySubscription.json + */ + /** + * Sample code: Gets list of Update Instances by Subscription. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void getsListOfUpdateInstancesBySubscription( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + manager.updateInstances().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesUpdateSamples.java new file mode 100644 index 0000000000000..81ae4f04822a1 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/samples/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for UpdateInstances Update. + */ +public final class UpdateInstancesUpdateSamples { + /* + * x-ms-original-file: 2026-11-02-preview/UpdateInstances_Update.json + */ + /** + * Sample code: Updates Update Instance. + * + * @param manager Entry point to DeviceRegistrySoftwareUpdateManager. + */ + public static void updatesUpdateInstance( + com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager manager) { + UpdateInstance resource = manager.updateInstances() + .getByResourceGroupWithResponse("test-rg", "contoso", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/AccountLinkingInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/AccountLinkingInnerTests.java new file mode 100644 index 0000000000000..25f109cfab501 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/AccountLinkingInnerTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.AccountLinkingInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.AccountLinkingState; +import org.junit.jupiter.api.Assertions; + +public final class AccountLinkingInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountLinkingInner model + = BinaryData.fromString("{\"namespaceResourceId\":\"cr\",\"linkingState\":\"InProgress\"}") + .toObject(AccountLinkingInner.class); + Assertions.assertEquals("cr", model.namespaceResourceId()); + Assertions.assertEquals(AccountLinkingState.IN_PROGRESS, model.linkingState()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityRequestTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityRequestTests.java new file mode 100644 index 0000000000000..68602967ac4cf --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityRequest model + = BinaryData.fromString("{\"name\":\"bnbdxkqpxokajion\",\"type\":\"mexgstxgcp\"}") + .toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("bnbdxkqpxokajion", model.name()); + Assertions.assertEquals("mexgstxgcp", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailabilityRequest model + = new CheckNameAvailabilityRequest().withName("bnbdxkqpxokajion").withType("mexgstxgcp"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("bnbdxkqpxokajion", model.name()); + Assertions.assertEquals("mexgstxgcp", model.type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityResultInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityResultInnerTests.java new file mode 100644 index 0000000000000..2c7687bab04f7 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/CheckNameAvailabilityResultInnerTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityReason; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityResultInner model + = BinaryData.fromString("{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"jrmvdjwzrlo\"}") + .toObject(CheckNameAvailabilityResultInner.class); + Assertions.assertFalse(model.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); + Assertions.assertEquals("jrmvdjwzrlo", model.message()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/InboundCallerIdentityTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/InboundCallerIdentityTests.java new file mode 100644 index 0000000000000..487e47f02bc37 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/InboundCallerIdentityTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.InboundCallerIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class InboundCallerIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InboundCallerIdentity model = BinaryData + .fromString("{\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentity\":\"dkexxppofm\"}") + .toObject(InboundCallerIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + Assertions.assertEquals("dkexxppofm", model.userAssignedIdentity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InboundCallerIdentity model + = new InboundCallerIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentity("dkexxppofm"); + model = BinaryData.fromObject(model).toObject(InboundCallerIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + Assertions.assertEquals("dkexxppofm", model.userAssignedIdentity()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkInitiateRequestTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkInitiateRequestTests.java new file mode 100644 index 0000000000000..a6e77353787e5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkInitiateRequestTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.InboundCallerIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkInitiateRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class LinkInitiateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkInitiateRequest model = BinaryData.fromString( + "{\"namespaceResourceId\":\"c\",\"namespaceUuid\":\"j\",\"dataAddress\":\"hvpmoue\",\"inboundCallerIdentity\":{\"type\":\"None\",\"userAssignedIdentity\":\"zxibqeoj\"}}") + .toObject(LinkInitiateRequest.class); + Assertions.assertEquals("c", model.namespaceResourceId()); + Assertions.assertEquals("j", model.namespaceUuid()); + Assertions.assertEquals("hvpmoue", model.dataAddress()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.inboundCallerIdentity().type()); + Assertions.assertEquals("zxibqeoj", model.inboundCallerIdentity().userAssignedIdentity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkInitiateRequest model = new LinkInitiateRequest().withNamespaceResourceId("c") + .withNamespaceUuid("j") + .withDataAddress("hvpmoue") + .withInboundCallerIdentity(new InboundCallerIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentity("zxibqeoj")); + model = BinaryData.fromObject(model).toObject(LinkInitiateRequest.class); + Assertions.assertEquals("c", model.namespaceResourceId()); + Assertions.assertEquals("j", model.namespaceUuid()); + Assertions.assertEquals("hvpmoue", model.dataAddress()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.inboundCallerIdentity().type()); + Assertions.assertEquals("zxibqeoj", model.inboundCallerIdentity().userAssignedIdentity()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkPreflightRequestTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkPreflightRequestTests.java new file mode 100644 index 0000000000000..cb4f1337e79da --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkPreflightRequestTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.InboundCallerIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkPreflightRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class LinkPreflightRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkPreflightRequest model = BinaryData.fromString( + "{\"namespaceResourceId\":\"mcl\",\"namespaceUuid\":\"hijco\",\"inboundCallerIdentity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentity\":\"tbzaqsqsycbkbfk\"}}") + .toObject(LinkPreflightRequest.class); + Assertions.assertEquals("mcl", model.namespaceResourceId()); + Assertions.assertEquals("hijco", model.namespaceUuid()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.inboundCallerIdentity().type()); + Assertions.assertEquals("tbzaqsqsycbkbfk", model.inboundCallerIdentity().userAssignedIdentity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkPreflightRequest model = new LinkPreflightRequest().withNamespaceResourceId("mcl") + .withNamespaceUuid("hijco") + .withInboundCallerIdentity(new InboundCallerIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentity("tbzaqsqsycbkbfk")); + model = BinaryData.fromObject(model).toObject(LinkPreflightRequest.class); + Assertions.assertEquals("mcl", model.namespaceResourceId()); + Assertions.assertEquals("hijco", model.namespaceUuid()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.inboundCallerIdentity().type()); + Assertions.assertEquals("tbzaqsqsycbkbfk", model.inboundCallerIdentity().userAssignedIdentity()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkUpdateRequestTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkUpdateRequestTests.java new file mode 100644 index 0000000000000..1e3c9a89773f6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkUpdateRequestTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.InboundCallerIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkUpdateRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class LinkUpdateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkUpdateRequest model = BinaryData.fromString( + "{\"namespaceResourceId\":\"ntwndeicbtwnpzao\",\"namespaceUuid\":\"uhrhcffcyddgl\",\"dataAddress\":\"t\",\"inboundCallerIdentity\":{\"type\":\"UserAssigned\",\"userAssignedIdentity\":\"wpyeicxmqciwqvh\"}}") + .toObject(LinkUpdateRequest.class); + Assertions.assertEquals("ntwndeicbtwnpzao", model.namespaceResourceId()); + Assertions.assertEquals("uhrhcffcyddgl", model.namespaceUuid()); + Assertions.assertEquals("t", model.dataAddress()); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.inboundCallerIdentity().type()); + Assertions.assertEquals("wpyeicxmqciwqvh", model.inboundCallerIdentity().userAssignedIdentity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkUpdateRequest model = new LinkUpdateRequest().withNamespaceResourceId("ntwndeicbtwnpzao") + .withNamespaceUuid("uhrhcffcyddgl") + .withDataAddress("t") + .withInboundCallerIdentity(new InboundCallerIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentity("wpyeicxmqciwqvh")); + model = BinaryData.fromObject(model).toObject(LinkUpdateRequest.class); + Assertions.assertEquals("ntwndeicbtwnpzao", model.namespaceResourceId()); + Assertions.assertEquals("uhrhcffcyddgl", model.namespaceUuid()); + Assertions.assertEquals("t", model.dataAddress()); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.inboundCallerIdentity().type()); + Assertions.assertEquals("wpyeicxmqciwqvh", model.inboundCallerIdentity().userAssignedIdentity()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkedResourceMetadataTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkedResourceMetadataTests.java new file mode 100644 index 0000000000000..7f4c2a2601c75 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/LinkedResourceMetadataTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.LinkedResourceMetadata; +import org.junit.jupiter.api.Assertions; + +public final class LinkedResourceMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkedResourceMetadata model + = BinaryData.fromString("{\"deviceCount\":1410609059}").toObject(LinkedResourceMetadata.class); + Assertions.assertEquals(1410609059, model.deviceCount()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/ManagedServiceIdentityTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/ManagedServiceIdentityTests.java new file mode 100644 index 0000000000000..d4dfcb91f2a10 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"dfdosygexp\",\"tenantId\":\"jakhmsbzjh\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"jbp\":{\"principalId\":\"dphlxaolt\",\"clientId\":\"trg\"},\"fpjkjlxofp\":{\"principalId\":\"fsinzgvfcjrwzoxx\",\"clientId\":\"felluwfzitonpe\"},\"yhuybbkpod\":{\"principalId\":\"hpf\",\"clientId\":\"ypininm\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("jbp", new UserAssignedIdentity(), "fpjkjlxofp", + new UserAssignedIdentity(), "yhuybbkpod", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationDisplayTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..07a5874283923 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..2d110f3683d50 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..c9b277499ec2b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..5f6a76c61a645 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"ixuigdtopbobj\",\"isDataAction\":false,\"display\":{\"provider\":\"w\",\"resource\":\"m\",\"operation\":\"hrzayvvtpgvdf\",\"description\":\"otkftutqxlngx\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceInnerTests.java new file mode 100644 index 0000000000000..0a0a06570d93b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceInnerTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstanceInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class UpdateInstanceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateInstanceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"serviceAddress\":\"pzvgnwzsymglzufc\",\"linking\":{\"namespaceResourceId\":\"kohdbiha\",\"linkingState\":\"Succeeded\"}},\"identity\":{\"principalId\":\"fcbjysagithxqha\",\"tenantId\":\"fpikxwczb\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"qniwbybrkxvdumj\":{\"principalId\":\"q\",\"clientId\":\"hiv\"},\"kryhtnapczwlokj\":{\"principalId\":\"tfwvukxgaudc\",\"clientId\":\"nhsjcnyej\"}}},\"location\":\"mkkvnip\",\"tags\":{\"nchgej\":\"z\",\"huxinpmqnj\":\"podmailzydehojwy\",\"vcputegj\":\"qwixjspro\"},\"id\":\"wmfdatscmdvpjhul\",\"name\":\"uuvmkjozkrwfnd\",\"type\":\"odjpslwejd\"}") + .toObject(UpdateInstanceInner.class); + Assertions.assertEquals("mkkvnip", model.location()); + Assertions.assertEquals("z", model.tags().get("nchgej")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateInstanceInner model = new UpdateInstanceInner().withLocation("mkkvnip") + .withTags(mapOf("nchgej", "z", "huxinpmqnj", "podmailzydehojwy", "vcputegj", "qwixjspro")) + .withProperties(new UpdateInstancePropertiesInner()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("qniwbybrkxvdumj", new UserAssignedIdentity(), "kryhtnapczwlokj", + new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(UpdateInstanceInner.class); + Assertions.assertEquals("mkkvnip", model.location()); + Assertions.assertEquals("z", model.tags().get("nchgej")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceListResultTests.java new file mode 100644 index 0000000000000..3a94aed50f920 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.implementation.models.UpdateInstanceListResult; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class UpdateInstanceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateInstanceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"serviceAddress\":\"zlljfmppeebvm\",\"linking\":{\"namespaceResourceId\":\"sabkyqduujitcjcz\",\"linkingState\":\"InProgress\"}},\"identity\":{\"principalId\":\"ndhkrw\",\"tenantId\":\"appd\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"tmrldhugjzzdatq\":{\"principalId\":\"wrwjfeu\",\"clientId\":\"hutje\"},\"huticndvkao\":{\"principalId\":\"oc\",\"clientId\":\"eablg\"},\"kjfkg\":{\"principalId\":\"yiftyhxhuro\",\"clientId\":\"tyxolniwpwc\"}}},\"location\":\"w\",\"tags\":{\"dhsgcba\":\"ryplwckbasyypn\",\"dlikwyqkgfgibma\":\"phejkotynqgoulz\",\"yb\":\"gakeqsr\",\"lmmnkzsmodmglo\":\"qqedqytbciqfou\"},\"id\":\"gpbkwtmut\",\"name\":\"uqktap\",\"type\":\"pwgcuertu\"},{\"properties\":{\"provisioningState\":\"Accepted\",\"serviceAddress\":\"vqwhbmdgbbjfd\",\"linking\":{\"namespaceResourceId\":\"mbmbexppbh\",\"linkingState\":\"InProgress\"}},\"identity\":{\"principalId\":\"ol\",\"tenantId\":\"fpsalgbqu\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"rkujy\":{\"principalId\":\"jgzjaoyfhrtx\",\"clientId\":\"n\"}}},\"location\":\"l\",\"tags\":{\"nwbxgjvtbvpyssz\":\"vfqawrlyxwjkcpr\",\"guhmuouqfpr\":\"nruj\",\"nguitnwuizgazxu\":\"zw\"},\"id\":\"izuckyfihrfidfvz\",\"name\":\"dzuhtymwi\",\"type\":\"dkfthwxmnt\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"serviceAddress\":\"pvkmijcmmxdcuf\",\"linking\":{\"namespaceResourceId\":\"srp\",\"linkingState\":\"Orphaned\"}},\"identity\":{\"principalId\":\"dnsezcxtbzs\",\"tenantId\":\"yc\",\"type\":\"None\",\"userAssignedIdentities\":{\"eeh\":{\"principalId\":\"mdwzjeiachboo\",\"clientId\":\"lnrosfqp\"},\"crmnohjtckwhds\":{\"principalId\":\"vypyqrimzinpv\",\"clientId\":\"jdkirsoodqx\"}}},\"location\":\"fiyipjxsqwpgrj\",\"tags\":{\"qabnmoc\":\"orcjxvsnby\",\"toqcjmklja\":\"cyshurzafbljjgp\",\"yulpkudjkr\":\"bqidtqaj\",\"e\":\"khbzhfepgzg\"},\"id\":\"zloc\",\"name\":\"scpai\",\"type\":\"rhhbcs\"}],\"nextLink\":\"ummajtjaod\"}") + .toObject(UpdateInstanceListResult.class); + Assertions.assertEquals("w", model.value().get(0).location()); + Assertions.assertEquals("ryplwckbasyypn", model.value().get(0).tags().get("dhsgcba")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("ummajtjaod", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancePropertiesInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancePropertiesInnerTests.java new file mode 100644 index 0000000000000..9c25a6c0ea438 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancePropertiesInnerTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; + +public final class UpdateInstancePropertiesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateInstancePropertiesInner model = BinaryData.fromString( + "{\"provisioningState\":\"Accepted\",\"serviceAddress\":\"yoqpsoaccta\",\"linking\":{\"namespaceResourceId\":\"kljla\",\"linkingState\":\"Succeeded\"}}") + .toObject(UpdateInstancePropertiesInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateInstancePropertiesInner model = new UpdateInstancePropertiesInner(); + model = BinaryData.fromObject(model).toObject(UpdateInstancePropertiesInner.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceUpdateTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceUpdateTests.java new file mode 100644 index 0000000000000..00c8a3833507d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstanceUpdateTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstanceUpdate; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class UpdateInstanceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateInstanceUpdate model = BinaryData.fromString( + "{\"tags\":{\"bwjzr\":\"ivyevcciqihnhun\"},\"identity\":{\"principalId\":\"gxg\",\"tenantId\":\"pemvtzfkufubljof\",\"type\":\"None\",\"userAssignedIdentities\":{\"jqul\":{\"principalId\":\"jaeq\",\"clientId\":\"qjbasvms\"},\"skcqvkocrcjd\":{\"principalId\":\"sntnbybkzgcw\",\"clientId\":\"clxxwrljdo\"},\"lssai\":{\"principalId\":\"tnhxbn\",\"clientId\":\"iksqr\"}}}}") + .toObject(UpdateInstanceUpdate.class); + Assertions.assertEquals("ivyevcciqihnhun", model.tags().get("bwjzr")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UpdateInstanceUpdate model = new UpdateInstanceUpdate().withTags(mapOf("bwjzr", "ivyevcciqihnhun")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("jqul", new UserAssignedIdentity(), "skcqvkocrcjd", + new UserAssignedIdentity(), "lssai", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(UpdateInstanceUpdate.class); + Assertions.assertEquals("ivyevcciqihnhun", model.tags().get("bwjzr")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilityWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilityWithResponseMockTests.java new file mode 100644 index 0000000000000..ae41285eaa235 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCheckNameAvailabilityWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.CheckNameAvailabilityResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class UpdateInstancesCheckNameAvailabilityWithResponseMockTests { + @Test + public void testCheckNameAvailabilityWithResponse() throws Exception { + String responseStr = "{\"nameAvailable\":true,\"reason\":\"AlreadyExists\",\"message\":\"pxjmflbvvnchr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CheckNameAvailabilityResult response = manager.updateInstances() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest().withName("wtruwiqzbqjvsovm").withType("kacspkw"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertTrue(response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); + Assertions.assertEquals("pxjmflbvvnchr", response.message()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateMockTests.java new file mode 100644 index 0000000000000..b3c8067436fde --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesCreateMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.fluent.models.UpdateInstancePropertiesInner; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class UpdateInstancesCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceAddress\":\"yxzk\",\"linking\":{\"namespaceResourceId\":\"ocukoklyax\",\"linkingState\":\"Orphaned\"}},\"identity\":{\"principalId\":\"uqszfk\",\"tenantId\":\"ypewrmjmwvvjekt\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"qdqgbi\":{\"principalId\":\"hwlrsf\",\"clientId\":\"zpwv\"},\"jf\":{\"principalId\":\"lihkaetcktvfc\",\"clientId\":\"fsnkymuctq\"}}},\"location\":\"brjcxe\",\"tags\":{\"phxepcyvahf\":\"wutttxfvjrbi\",\"gidokgjljyoxgvcl\":\"ljkyqxjvuuj\",\"jhtxfvgxbfsmxne\":\"bgsncghkjeszzhb\",\"rbmpukgri\":\"mpvecxgodebfqk\"},\"id\":\"flz\",\"name\":\"fbxzpuzycisp\",\"type\":\"qzahmgkbrp\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + UpdateInstance response + = manager.updateInstances() + .define("zjuqkhrsaj") + .withRegion("zfbishcbkhaj") + .withExistingResourceGroup("cciw") + .withTags(mapOf("agalpbuxwgipwhon", "eamdp", "kix", "wkgshwa", "eputtmrywnuzoqf", "bin", + "qvyxlwhzlsicoho", "iyqzrnk")) + .withProperties(new UpdateInstancePropertiesInner()) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("vmezy", new UserAssignedIdentity(), "oenkouknvudwti", + new UserAssignedIdentity(), "npiucgygevqznty", new UserAssignedIdentity(), "jzicwifsjt", + new UserAssignedIdentity()))) + .create(); + + Assertions.assertEquals("brjcxe", response.location()); + Assertions.assertEquals("wutttxfvjrbi", response.tags().get("phxepcyvahf")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..d45589cd078ce --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class UpdateInstancesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Accepted\",\"serviceAddress\":\"igeho\",\"linking\":{\"namespaceResourceId\":\"bowsk\",\"linkingState\":\"InProgress\"}},\"identity\":{\"principalId\":\"tzlcuiywgqywgn\",\"tenantId\":\"vynhzgpphrcg\",\"type\":\"None\",\"userAssignedIdentities\":{\"coofsxlzev\":{\"principalId\":\"pec\",\"clientId\":\"m\"},\"vkwlzuvccfwnf\":{\"principalId\":\"m\",\"clientId\":\"qabcypm\"},\"bxetqgtzxdpn\":{\"principalId\":\"acfi\",\"clientId\":\"l\"}}},\"location\":\"qqwx\",\"tags\":{\"mpmngnzscxaqwoo\":\"eallnwsubisnj\",\"njeaseipheofloke\":\"hcbonqvpkvlr\",\"enjbdlwtgrhp\":\"y\"},\"id\":\"jp\",\"name\":\"umasxazjpq\",\"type\":\"e\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + UpdateInstance response = manager.updateInstances() + .getByResourceGroupWithResponse("gnxkrxdqmidtth", "rvqdra", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qqwx", response.location()); + Assertions.assertEquals("eallnwsubisnj", response.tags().get("mpmngnzscxaqwoo")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..0fba3c99c1fbe --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListByResourceGroupMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class UpdateInstancesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"serviceAddress\":\"dgwdslfhot\",\"linking\":{\"namespaceResourceId\":\"cynpwlbjnp\",\"linkingState\":\"InProgress\"}},\"identity\":{\"principalId\":\"tadehxnltyfsopp\",\"tenantId\":\"uesnzwdejbavo\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"jjugwdkcglhslaz\":{\"principalId\":\"ohctbqvudwx\",\"clientId\":\"dnvowg\"}}},\"location\":\"yggdtjixh\",\"tags\":{\"fwhybcibvy\":\"ofqweykhmenevfye\",\"ynnaam\":\"dcsi\"},\"id\":\"ectehf\",\"name\":\"qsc\",\"type\":\"eypvhezrkg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.updateInstances().listByResourceGroup("ualhbxxhejj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("yggdtjixh", response.iterator().next().location()); + Assertions.assertEquals("ofqweykhmenevfye", response.iterator().next().tags().get("fwhybcibvy")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListMockTests.java new file mode 100644 index 0000000000000..890b30aa7aca2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UpdateInstancesListMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.softwareupdate.DeviceRegistrySoftwareUpdateManager; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UpdateInstance; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class UpdateInstancesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"serviceAddress\":\"efovgmk\",\"linking\":{\"namespaceResourceId\":\"leyyvx\",\"linkingState\":\"Orphaned\"}},\"identity\":{\"principalId\":\"k\",\"tenantId\":\"t\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"ounqecano\":{\"principalId\":\"cr\",\"clientId\":\"zsqpjhvmdajvny\"},\"cma\":{\"principalId\":\"upfh\",\"clientId\":\"ltrpmopj\"},\"fcp\":{\"principalId\":\"okth\",\"clientId\":\"iuaod\"},\"uokktwhrdxwz\":{\"principalId\":\"xodpuozmyzydagfu\",\"clientId\":\"bezy\"}}},\"location\":\"q\",\"tags\":{\"moryocfsfksym\":\"surex\",\"o\":\"dystkiiuxhqyud\",\"b\":\"rq\"},\"id\":\"oczvy\",\"name\":\"fqrvkdvjsllrmvvd\",\"type\":\"watkpnpulexxb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistrySoftwareUpdateManager manager = DeviceRegistrySoftwareUpdateManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.updateInstances().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("q", response.iterator().next().location()); + Assertions.assertEquals("surex", response.iterator().next().tags().get("moryocfsfksym")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UserAssignedIdentityTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UserAssignedIdentityTests.java new file mode 100644 index 0000000000000..f062d4ce0b2b8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/src/test/java/com/azure/resourcemanager/deviceregistry/softwareupdate/generated/UserAssignedIdentityTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.softwareupdate.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.softwareupdate.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model + = BinaryData.fromString("{\"principalId\":\"ooginuvamih\",\"clientId\":\"gnarxzxtheo\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/tsp-location.yaml b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/tsp-location.yaml new file mode 100644 index 0000000000000..537e990e4d225 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry-softwareupdate/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/deviceupdate/resource-manager/Microsoft.DeviceUpdate/DuDeviceRegistry +commit: 1937998d2d092451f08d4aa5f35dd93ebf2cf6cf +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/deviceregistry/ci.yml b/sdk/deviceregistry/ci.yml index 06974513bc483..88f22663a54a9 100644 --- a/sdk/deviceregistry/ci.yml +++ b/sdk/deviceregistry/ci.yml @@ -46,6 +46,10 @@ parameters: displayName: azure-iot-deviceregistry-softwareupdate type: boolean default: true + - name: release_azureresourcemanagerdeviceregistrysoftwareupdate + displayName: azure-resourcemanager-deviceregistry-softwareupdate + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -60,3 +64,7 @@ extends: groupId: com.azure safeName: azureiotdeviceregistrysoftwareupdate releaseInBatch: ${{ parameters.release_azureiotdeviceregistrysoftwareupdate }} + - name: azure-resourcemanager-deviceregistry-softwareupdate + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdeviceregistrysoftwareupdate + releaseInBatch: ${{ parameters.release_azureresourcemanagerdeviceregistrysoftwareupdate }} diff --git a/sdk/deviceregistry/pom.xml b/sdk/deviceregistry/pom.xml index b747e58ec6046..abf58b82f4259 100644 --- a/sdk/deviceregistry/pom.xml +++ b/sdk/deviceregistry/pom.xml @@ -13,5 +13,6 @@ azure-iot-deviceregistry-softwareupdate azure-iot-deviceregistry-softwareupdate/customization azure-resourcemanager-deviceregistry + azure-resourcemanager-deviceregistry-softwareupdate