diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index d034af26501e..76a089d6b32d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -576,3 +576,4 @@ unreleased_io.clientcore:http-netty4;1.0.0-beta.1 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure.resourcemanager:azure-resourcemanager-appcontainers;1.2.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-programenrollment;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 51a0cef029f1..6e23e712989c 100644 --- a/pom.xml +++ b/pom.xml @@ -208,6 +208,7 @@ sdk/postgresqlflexibleserver sdk/powerbidedicated sdk/privatedns + sdk/programenrollment sdk/programmableconnectivity sdk/providerhub sdk/purestorageblock diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/CHANGELOG.md b/sdk/programenrollment/azure-resourcemanager-programenrollment/CHANGELOG.md new file mode 100644 index 000000000000..6b1782309fa9 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.1 (2026-05-30) + +### Features Added + +- Initial release of Azure Resource Manager ProgramEnrollment client library for Java. +- Management SDK for Microsoft.ProgramEnrollment, API version 2026-03-01-preview. +- For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/README.md b/sdk/programenrollment/azure-resourcemanager-programenrollment/README.md new file mode 100644 index 000000000000..13502e82f220 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ProgramEnrollment client library for Java + +Azure Resource Manager ProgramEnrollment client library for Java. + +This package contains Microsoft Azure SDK for ProgramEnrollment Management SDK. Package api-version 2026-03-01-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-programenrollment;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-programenrollment + 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(); +ProgramEnrollmentManager manager = ProgramEnrollmentManager + .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/programenrollment/azure-resourcemanager-programenrollment/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/programenrollment/azure-resourcemanager-programenrollment/SAMPLE.md b/sdk/programenrollment/azure-resourcemanager-programenrollment/SAMPLE.md new file mode 100644 index 000000000000..cb7bf24f070e --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/SAMPLE.md @@ -0,0 +1,200 @@ +# Code snippets and samples + + +## EduEnrollments + +- [CreateOrUpdate](#eduenrollments_createorupdate) +- [Delete](#eduenrollments_delete) +- [GetByResourceGroup](#eduenrollments_getbyresourcegroup) +- [List](#eduenrollments_list) +- [ListByResourceGroup](#eduenrollments_listbyresourcegroup) +- [Update](#eduenrollments_update) + +## Operations + +- [List](#operations_list) +### EduEnrollments_CreateOrUpdate + +```java +import com.azure.resourcemanager.programenrollment.models.DomainGroup; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentProperties; +import java.util.Arrays; + +/** + * Samples for EduEnrollments CreateOrUpdate. + */ +public final class EduEnrollmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_CreateOrUpdate.json + */ + /** + * Sample code: Create or update an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + createOrUpdateAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments() + .define("default") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new EduEnrollmentProperties().withDomains( + Arrays.asList(new DomainGroup().withDomainNames(Arrays.asList("university.edu", "college.edu")) + .withTenantId("00000000-0000-0000-0000-000000000001")))) + .create(); + } +} +``` + +### EduEnrollments_Delete + +```java +/** + * Samples for EduEnrollments Delete. + */ +public final class EduEnrollmentsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Delete.json + */ + /** + * Sample code: Delete an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + deleteAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments() + .deleteByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE); + } +} +``` + +### EduEnrollments_GetByResourceGroup + +```java +/** + * Samples for EduEnrollments GetByResourceGroup. + */ +public final class EduEnrollmentsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Get.json + */ + /** + * Sample code: Get an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + getAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().getByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE); + } +} +``` + +### EduEnrollments_List + +```java +/** + * Samples for EduEnrollments List. + */ +public final class EduEnrollmentsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_ListBySubscription.json + */ + /** + * Sample code: List edu enrollments by subscription. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + listEduEnrollmentsBySubscription(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().list(com.azure.core.util.Context.NONE); + } +} +``` + +### EduEnrollments_ListByResourceGroup + +```java +/** + * Samples for EduEnrollments ListByResourceGroup. + */ +public final class EduEnrollmentsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_ListByResourceGroup.json + */ + /** + * Sample code: List edu enrollments by resource group. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void listEduEnrollmentsByResourceGroup( + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### EduEnrollments_Update + +```java +import com.azure.resourcemanager.programenrollment.models.EduEnrollment; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EduEnrollments Update. + */ +public final class EduEnrollmentsUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Update.json + */ + /** + * Sample code: Update an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + updateAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + EduEnrollment resource = manager.eduEnrollments() + .getByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("env", "test")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/Operations_List.json + */ + /** + * Sample code: List operations for Microsoft.ProgramEnrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void listOperationsForMicrosoftProgramEnrollment( + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/pom.xml b/sdk/programenrollment/azure-resourcemanager-programenrollment/pom.xml new file mode 100644 index 000000000000..6986512fd031 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/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-programenrollment + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ProgramEnrollment Management + This package contains Microsoft Azure SDK for ProgramEnrollment Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package api-version 2026-03-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.58.0 + + + com.azure + azure-core-management + 1.19.4 + + + com.azure + azure-core-test + 1.27.0-beta.15 + test + + + com.azure + azure-identity + 1.18.3 + test + + + diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/ProgramEnrollmentManager.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/ProgramEnrollmentManager.java new file mode 100644 index 000000000000..02d8dc9b1b46 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/ProgramEnrollmentManager.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment; + +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.programenrollment.fluent.ProgramEnrollmentManagementClient; +import com.azure.resourcemanager.programenrollment.implementation.EduEnrollmentsImpl; +import com.azure.resourcemanager.programenrollment.implementation.OperationsImpl; +import com.azure.resourcemanager.programenrollment.implementation.ProgramEnrollmentManagementClientBuilder; +import com.azure.resourcemanager.programenrollment.models.EduEnrollments; +import com.azure.resourcemanager.programenrollment.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ProgramEnrollmentManager. + */ +public final class ProgramEnrollmentManager { + private Operations operations; + + private EduEnrollments eduEnrollments; + + private final ProgramEnrollmentManagementClient clientObject; + + private ProgramEnrollmentManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ProgramEnrollmentManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ProgramEnrollment service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ProgramEnrollment service API instance. + */ + public static ProgramEnrollmentManager 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 ProgramEnrollment service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ProgramEnrollment service API instance. + */ + public static ProgramEnrollmentManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ProgramEnrollmentManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ProgramEnrollmentManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ProgramEnrollmentManager.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-programenrollment.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 ProgramEnrollment service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ProgramEnrollment service API instance. + */ + public ProgramEnrollmentManager 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.programenrollment") + .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 ProgramEnrollmentManager(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 EduEnrollments. It manages EduEnrollment. + * + * @return Resource collection API of EduEnrollments. + */ + public EduEnrollments eduEnrollments() { + if (this.eduEnrollments == null) { + this.eduEnrollments = new EduEnrollmentsImpl(clientObject.getEduEnrollments(), this); + } + return eduEnrollments; + } + + /** + * Gets wrapped service client ProgramEnrollmentManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ProgramEnrollmentManagementClient. + */ + public ProgramEnrollmentManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/EduEnrollmentsClient.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/EduEnrollmentsClient.java new file mode 100644 index 000000000000..081f0718d53e --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/EduEnrollmentsClient.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.models.EduEnrollmentInner; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentPatch; + +/** + * An instance of this class provides access to all the operations defined in EduEnrollmentsClient. + */ +public interface EduEnrollmentsClient { + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @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 EduEnrollment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, + Context context); + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EduEnrollmentInner getByResourceGroup(String resourceGroupName, String enrollmentName); + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an education program enrollment that groups Entra domains under a + * single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EduEnrollmentInner> beginCreateOrUpdate(String resourceGroupName, + String enrollmentName, EduEnrollmentInner resource); + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an education program enrollment that groups Entra domains under a + * single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EduEnrollmentInner> beginCreateOrUpdate(String resourceGroupName, + String enrollmentName, EduEnrollmentInner resource, Context context); + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EduEnrollmentInner createOrUpdate(String resourceGroupName, String enrollmentName, EduEnrollmentInner resource); + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EduEnrollmentInner createOrUpdate(String resourceGroupName, String enrollmentName, EduEnrollmentInner resource, + Context context); + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String enrollmentName, + EduEnrollmentPatch properties, Context context); + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EduEnrollmentInner update(String resourceGroupName, String enrollmentName, EduEnrollmentPatch properties); + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String enrollmentName, Context context); + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 enrollmentName); + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List EduEnrollment resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/OperationsClient.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/OperationsClient.java new file mode 100644 index 000000000000..79321070f7eb --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/ProgramEnrollmentManagementClient.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/ProgramEnrollmentManagementClient.java new file mode 100644 index 000000000000..914eb94701be --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/ProgramEnrollmentManagementClient.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.programenrollment.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ProgramEnrollmentManagementClient class. + */ +public interface ProgramEnrollmentManagementClient { + /** + * 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 EduEnrollmentsClient object to access its operations. + * + * @return the EduEnrollmentsClient object. + */ + EduEnrollmentsClient getEduEnrollments(); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/EduEnrollmentInner.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/EduEnrollmentInner.java new file mode 100644 index 000000000000..372e444a915f --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/EduEnrollmentInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.models.EduEnrollmentProperties; +import java.io.IOException; +import java.util.Map; + +/** + * An education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ +@Fluent +public final class EduEnrollmentInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private EduEnrollmentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EduEnrollmentInner class. + */ + public EduEnrollmentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public EduEnrollmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the EduEnrollmentInner object itself. + */ + public EduEnrollmentInner withProperties(EduEnrollmentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EduEnrollmentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EduEnrollmentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EduEnrollmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EduEnrollmentInner 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 EduEnrollmentInner. + */ + public static EduEnrollmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EduEnrollmentInner deserializedEduEnrollmentInner = new EduEnrollmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEduEnrollmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEduEnrollmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEduEnrollmentInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEduEnrollmentInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEduEnrollmentInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedEduEnrollmentInner.properties = EduEnrollmentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEduEnrollmentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEduEnrollmentInner; + }); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/OperationInner.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/OperationInner.java new file mode 100644 index 000000000000..6bc655ce9e82 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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.programenrollment.models.ActionType; +import com.azure.resourcemanager.programenrollment.models.OperationDisplay; +import com.azure.resourcemanager.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/package-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/package-info.java new file mode 100644 index 000000000000..e2bfe95b232a --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ProgramEnrollment. + */ +package com.azure.resourcemanager.programenrollment.fluent.models; diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/package-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/package-info.java new file mode 100644 index 000000000000..aa7e0ec57969 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ProgramEnrollment. + */ +package com.azure.resourcemanager.programenrollment.fluent; diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentImpl.java new file mode 100644 index 000000000000..3567fbe8e7c1 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner; +import com.azure.resourcemanager.programenrollment.models.EduEnrollment; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentPatch; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentProperties; +import java.util.Collections; +import java.util.Map; + +public final class EduEnrollmentImpl implements EduEnrollment, EduEnrollment.Definition, EduEnrollment.Update { + private EduEnrollmentInner innerObject; + + private final com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager 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 EduEnrollmentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EduEnrollmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String enrollmentName; + + private EduEnrollmentPatch updateProperties; + + public EduEnrollmentImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public EduEnrollment create() { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .createOrUpdate(resourceGroupName, enrollmentName, this.innerModel(), Context.NONE); + return this; + } + + public EduEnrollment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .createOrUpdate(resourceGroupName, enrollmentName, this.innerModel(), context); + return this; + } + + EduEnrollmentImpl(String name, + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager) { + this.innerObject = new EduEnrollmentInner(); + this.serviceManager = serviceManager; + this.enrollmentName = name; + } + + public EduEnrollmentImpl update() { + this.updateProperties = new EduEnrollmentPatch(); + return this; + } + + public EduEnrollment apply() { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .updateWithResponse(resourceGroupName, enrollmentName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public EduEnrollment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .updateWithResponse(resourceGroupName, enrollmentName, updateProperties, context) + .getValue(); + return this; + } + + EduEnrollmentImpl(EduEnrollmentInner innerObject, + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.enrollmentName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "eduEnrollments"); + } + + public EduEnrollment refresh() { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .getByResourceGroupWithResponse(resourceGroupName, enrollmentName, Context.NONE) + .getValue(); + return this; + } + + public EduEnrollment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEduEnrollments() + .getByResourceGroupWithResponse(resourceGroupName, enrollmentName, context) + .getValue(); + return this; + } + + public EduEnrollmentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EduEnrollmentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EduEnrollmentImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public EduEnrollmentImpl withProperties(EduEnrollmentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsClientImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsClientImpl.java new file mode 100644 index 000000000000..0150f5f5ec57 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsClientImpl.java @@ -0,0 +1,932 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient; +import com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner; +import com.azure.resourcemanager.programenrollment.implementation.models.EduEnrollmentListResult; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentPatch; +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 EduEnrollmentsClient. + */ +public final class EduEnrollmentsClientImpl implements EduEnrollmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EduEnrollmentsService service; + + /** + * The service client containing this operation class. + */ + private final ProgramEnrollmentManagementClientImpl client; + + /** + * Initializes an instance of EduEnrollmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EduEnrollmentsClientImpl(ProgramEnrollmentManagementClientImpl client) { + this.service + = RestProxy.create(EduEnrollmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgramEnrollmentManagementClientEduEnrollments to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgramEnrollmentManagementClientEduEnrollments") + public interface EduEnrollmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @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("enrollmentName") String enrollmentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @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("enrollmentName") String enrollmentName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EduEnrollmentInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EduEnrollmentInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EduEnrollmentPatch properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EduEnrollmentPatch properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments/{enrollmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enrollmentName") String enrollmentName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ProgramEnrollment/eduEnrollments") + @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.ProgramEnrollment/eduEnrollments") + @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.ProgramEnrollment/eduEnrollments") + @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.ProgramEnrollment/eduEnrollments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String enrollmentName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String enrollmentName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, enrollmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, accept, context); + } + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EduEnrollmentInner getByResourceGroup(String resourceGroupName, String enrollmentName) { + return getByResourceGroupWithResponse(resourceGroupName, enrollmentName, Context.NONE).getValue(); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String enrollmentName, EduEnrollmentInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String enrollmentName, + EduEnrollmentInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String enrollmentName, + EduEnrollmentInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, contentType, accept, resource, context); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an education program enrollment that groups Entra domains under a + * single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EduEnrollmentInner> + beginCreateOrUpdateAsync(String resourceGroupName, String enrollmentName, EduEnrollmentInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, enrollmentName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + EduEnrollmentInner.class, EduEnrollmentInner.class, this.client.getContext()); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an education program enrollment that groups Entra domains under a + * single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EduEnrollmentInner> beginCreateOrUpdate(String resourceGroupName, + String enrollmentName, EduEnrollmentInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, enrollmentName, resource); + return this.client.getLroResult(response, EduEnrollmentInner.class, + EduEnrollmentInner.class, Context.NONE); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an education program enrollment that groups Entra domains under a + * single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EduEnrollmentInner> beginCreateOrUpdate(String resourceGroupName, + String enrollmentName, EduEnrollmentInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, enrollmentName, resource, context); + return this.client.getLroResult(response, EduEnrollmentInner.class, + EduEnrollmentInner.class, context); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String enrollmentName, + EduEnrollmentInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, enrollmentName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EduEnrollmentInner createOrUpdate(String resourceGroupName, String enrollmentName, + EduEnrollmentInner resource) { + return beginCreateOrUpdate(resourceGroupName, enrollmentName, resource).getFinalResult(); + } + + /** + * Create a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EduEnrollmentInner createOrUpdate(String resourceGroupName, String enrollmentName, + EduEnrollmentInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, enrollmentName, resource, context).getFinalResult(); + } + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String enrollmentName, + EduEnrollmentPatch 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, enrollmentName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String enrollmentName, + EduEnrollmentPatch properties) { + return updateWithResponseAsync(resourceGroupName, enrollmentName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String enrollmentName, + EduEnrollmentPatch 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, enrollmentName, contentType, accept, properties, + context); + } + + /** + * Update a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an education program enrollment that groups Entra domains under a single sovereign/edu program scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EduEnrollmentInner update(String resourceGroupName, String enrollmentName, EduEnrollmentPatch properties) { + return updateWithResponse(resourceGroupName, enrollmentName, properties, Context.NONE).getValue(); + } + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 enrollmentName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 enrollmentName) { + return deleteWithResponseAsync(resourceGroupName, enrollmentName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String enrollmentName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enrollmentName, context); + } + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String enrollmentName) { + deleteWithResponse(resourceGroupName, enrollmentName, Context.NONE); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List EduEnrollment resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get 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 EduEnrollment 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 EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment 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 EduEnrollment 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 EduEnrollment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment 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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsImpl.java new file mode 100644 index 000000000000..a96bbcb96a4f --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.EduEnrollmentsClient; +import com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner; +import com.azure.resourcemanager.programenrollment.models.EduEnrollment; +import com.azure.resourcemanager.programenrollment.models.EduEnrollments; + +public final class EduEnrollmentsImpl implements EduEnrollments { + private static final ClientLogger LOGGER = new ClientLogger(EduEnrollmentsImpl.class); + + private final EduEnrollmentsClient innerClient; + + private final com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager; + + public EduEnrollmentsImpl(EduEnrollmentsClient innerClient, + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, enrollmentName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EduEnrollmentImpl(inner.getValue(), this.manager())); + } + + public EduEnrollment getByResourceGroup(String resourceGroupName, String enrollmentName) { + EduEnrollmentInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, enrollmentName); + if (inner != null) { + return new EduEnrollmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, enrollmentName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String enrollmentName) { + this.serviceClient().delete(resourceGroupName, enrollmentName); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EduEnrollmentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EduEnrollmentImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EduEnrollmentImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EduEnrollmentImpl(inner1, this.manager())); + } + + public EduEnrollment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enrollmentName = ResourceManagerUtils.getValueFromIdByName(id, "eduEnrollments"); + if (enrollmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'eduEnrollments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enrollmentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enrollmentName = ResourceManagerUtils.getValueFromIdByName(id, "eduEnrollments"); + if (enrollmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'eduEnrollments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enrollmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enrollmentName = ResourceManagerUtils.getValueFromIdByName(id, "eduEnrollments"); + if (enrollmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'eduEnrollments'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, enrollmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enrollmentName = ResourceManagerUtils.getValueFromIdByName(id, "eduEnrollments"); + if (enrollmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'eduEnrollments'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, enrollmentName, context); + } + + private EduEnrollmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager() { + return this.serviceManager; + } + + public EduEnrollmentImpl define(String name) { + return new EduEnrollmentImpl(name, this.manager()); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationImpl.java new file mode 100644 index 000000000000..176a732b214a --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.implementation; + +import com.azure.resourcemanager.programenrollment.fluent.models.OperationInner; +import com.azure.resourcemanager.programenrollment.models.ActionType; +import com.azure.resourcemanager.programenrollment.models.Operation; +import com.azure.resourcemanager.programenrollment.models.OperationDisplay; +import com.azure.resourcemanager.programenrollment.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager 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.programenrollment.ProgramEnrollmentManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsClientImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..1f80c637ee9f --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.OperationsClient; +import com.azure.resourcemanager.programenrollment.fluent.models.OperationInner; +import com.azure.resourcemanager.programenrollment.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 ProgramEnrollmentManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ProgramEnrollmentManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ProgramEnrollmentManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProgramEnrollmentManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ProgramEnrollment/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.ProgramEnrollment/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsImpl.java new file mode 100644 index 000000000000..81906e4e8734 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.OperationsClient; +import com.azure.resourcemanager.programenrollment.fluent.models.OperationInner; +import com.azure.resourcemanager.programenrollment.models.Operation; +import com.azure.resourcemanager.programenrollment.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.programenrollment.ProgramEnrollmentManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientBuilder.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientBuilder.java new file mode 100644 index 000000000000..8ec34d4dbfea --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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 ProgramEnrollmentManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ProgramEnrollmentManagementClientImpl.class }) +public final class ProgramEnrollmentManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder 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 ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder 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 ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder 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 ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder 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 ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder 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 ProgramEnrollmentManagementClientBuilder. + */ + public ProgramEnrollmentManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ProgramEnrollmentManagementClientImpl with the provided parameters. + * + * @return an instance of ProgramEnrollmentManagementClientImpl. + */ + public ProgramEnrollmentManagementClientImpl 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(); + ProgramEnrollmentManagementClientImpl client = new ProgramEnrollmentManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientImpl.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientImpl.java new file mode 100644 index 000000000000..1f5990f7c916 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient; +import com.azure.resourcemanager.programenrollment.fluent.OperationsClient; +import com.azure.resourcemanager.programenrollment.fluent.ProgramEnrollmentManagementClient; +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 ProgramEnrollmentManagementClientImpl type. + */ +@ServiceClient(builder = ProgramEnrollmentManagementClientBuilder.class) +public final class ProgramEnrollmentManagementClientImpl implements ProgramEnrollmentManagementClient { + /** + * 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 EduEnrollmentsClient object to access its operations. + */ + private final EduEnrollmentsClient eduEnrollments; + + /** + * Gets the EduEnrollmentsClient object to access its operations. + * + * @return the EduEnrollmentsClient object. + */ + public EduEnrollmentsClient getEduEnrollments() { + return this.eduEnrollments; + } + + /** + * Initializes an instance of ProgramEnrollmentManagementClient 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. + */ + ProgramEnrollmentManagementClientImpl(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-03-01-preview"; + this.operations = new OperationsClientImpl(this); + this.eduEnrollments = new EduEnrollmentsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProgramEnrollmentManagementClientImpl.class); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ResourceManagerUtils.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..7af7bcf250d9 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/EduEnrollmentListResult.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/EduEnrollmentListResult.java new file mode 100644 index 000000000000..8ee20bddc38f --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/EduEnrollmentListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.models.EduEnrollmentInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EduEnrollment list operation. + */ +@Immutable +public final class EduEnrollmentListResult implements JsonSerializable { + /* + * The EduEnrollment items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of EduEnrollmentListResult class. + */ + private EduEnrollmentListResult() { + } + + /** + * Get the value property: The EduEnrollment 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 EduEnrollmentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EduEnrollmentListResult 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 EduEnrollmentListResult. + */ + public static EduEnrollmentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EduEnrollmentListResult deserializedEduEnrollmentListResult = new EduEnrollmentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EduEnrollmentInner.fromJson(reader1)); + deserializedEduEnrollmentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEduEnrollmentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEduEnrollmentListResult; + }); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/OperationListResult.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..b7a0e5f658d2 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/package-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/package-info.java new file mode 100644 index 000000000000..9d17087d73cd --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ProgramEnrollment. + */ +package com.azure.resourcemanager.programenrollment.implementation; diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/ActionType.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/ActionType.java new file mode 100644 index 000000000000..bbb94772f52b --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroup.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroup.java new file mode 100644 index 000000000000..0abc67df2369 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroup.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.models; + +import com.azure.core.annotation.Fluent; +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; + +/** + * A group of edu domains scoped to an Entra tenant. + */ +@Fluent +public final class DomainGroup implements JsonSerializable { + /* + * The edu domain names in this group. + */ + private List domainNames; + + /* + * The Entra tenant ID that owns these domains. Defaults to the caller's tenant if omitted. + */ + private String tenantId; + + /* + * The assessment state of this domain group. + */ + private DomainGroupState state; + + /* + * Failure detail when state is Failed or ActionRequired. Omitted otherwise. + */ + private ManagementError failureReason; + + /** + * Creates an instance of DomainGroup class. + */ + public DomainGroup() { + } + + /** + * Get the domainNames property: The edu domain names in this group. + * + * @return the domainNames value. + */ + public List domainNames() { + return this.domainNames; + } + + /** + * Set the domainNames property: The edu domain names in this group. + * + * @param domainNames the domainNames value to set. + * @return the DomainGroup object itself. + */ + public DomainGroup withDomainNames(List domainNames) { + this.domainNames = domainNames; + return this; + } + + /** + * Get the tenantId property: The Entra tenant ID that owns these domains. Defaults to the caller's tenant if + * omitted. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The Entra tenant ID that owns these domains. Defaults to the caller's tenant if + * omitted. + * + * @param tenantId the tenantId value to set. + * @return the DomainGroup object itself. + */ + public DomainGroup withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the state property: The assessment state of this domain group. + * + * @return the state value. + */ + public DomainGroupState state() { + return this.state; + } + + /** + * Get the failureReason property: Failure detail when state is Failed or ActionRequired. Omitted otherwise. + * + * @return the failureReason value. + */ + public ManagementError failureReason() { + return this.failureReason; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("domainNames", this.domainNames, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("tenantId", this.tenantId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DomainGroup from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DomainGroup 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 DomainGroup. + */ + public static DomainGroup fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DomainGroup deserializedDomainGroup = new DomainGroup(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domainNames".equals(fieldName)) { + List domainNames = reader.readArray(reader1 -> reader1.getString()); + deserializedDomainGroup.domainNames = domainNames; + } else if ("tenantId".equals(fieldName)) { + deserializedDomainGroup.tenantId = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedDomainGroup.state = DomainGroupState.fromString(reader.getString()); + } else if ("failureReason".equals(fieldName)) { + deserializedDomainGroup.failureReason = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDomainGroup; + }); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroupState.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroupState.java new file mode 100644 index 000000000000..48205d1fb3b5 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroupState.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.programenrollment.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The assessment state of a domain group. + */ +public final class DomainGroupState extends ExpandableStringEnum { + /** + * Assessment is pending. + */ + public static final DomainGroupState PENDING = fromString("Pending"); + + /** + * Action is required to complete assessment. + */ + public static final DomainGroupState ACTION_REQUIRED = fromString("ActionRequired"); + + /** + * Assessment failed. + */ + public static final DomainGroupState FAILED = fromString("Failed"); + + /** + * Assessment succeeded. + */ + public static final DomainGroupState SUCCEEDED = fromString("Succeeded"); + + /** + * Creates a new instance of DomainGroupState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DomainGroupState() { + } + + /** + * Creates or finds a DomainGroupState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DomainGroupState. + */ + public static DomainGroupState fromString(String name) { + return fromString(name, DomainGroupState.class); + } + + /** + * Gets known DomainGroupState values. + * + * @return known DomainGroupState values. + */ + public static Collection values() { + return values(DomainGroupState.class); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollment.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollment.java new file mode 100644 index 000000000000..4b5f34177a19 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollment.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner; +import java.util.Map; + +/** + * An immutable client-side representation of EduEnrollment. + */ +public interface EduEnrollment { + /** + * 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. + */ + EduEnrollmentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner object. + * + * @return the inner object. + */ + EduEnrollmentInner innerModel(); + + /** + * The entirety of the EduEnrollment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The EduEnrollment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the EduEnrollment definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the EduEnrollment 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 EduEnrollment 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 EduEnrollment definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + EduEnrollment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EduEnrollment create(Context context); + } + + /** + * The stage of the EduEnrollment 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 EduEnrollment 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(EduEnrollmentProperties properties); + } + } + + /** + * Begins update for the EduEnrollment resource. + * + * @return the stage of resource update. + */ + EduEnrollment.Update update(); + + /** + * The template for EduEnrollment update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EduEnrollment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EduEnrollment apply(Context context); + } + + /** + * The EduEnrollment update stages. + */ + interface UpdateStages { + /** + * The stage of the EduEnrollment update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EduEnrollment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EduEnrollment refresh(Context context); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentPatch.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentPatch.java new file mode 100644 index 000000000000..36f75b69eb56 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentPatch.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the EduEnrollment. + */ +@Fluent +public final class EduEnrollmentPatch implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of EduEnrollmentPatch class. + */ + public EduEnrollmentPatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EduEnrollmentPatch object itself. + */ + public EduEnrollmentPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EduEnrollmentPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EduEnrollmentPatch 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 EduEnrollmentPatch. + */ + public static EduEnrollmentPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EduEnrollmentPatch deserializedEduEnrollmentPatch = new EduEnrollmentPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEduEnrollmentPatch.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedEduEnrollmentPatch; + }); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentProperties.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentProperties.java new file mode 100644 index 000000000000..8ae3eae616e0 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentProperties.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.models; + +import com.azure.core.annotation.Fluent; +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; + +/** + * Details of the Program EduEnrollment. + */ +@Fluent +public final class EduEnrollmentProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The domain groups associated with this enrollment. + */ + private List domains; + + /* + * Failure detail when provisioningState is Failed. Omitted otherwise. + */ + private ManagementError failureReason; + + /** + * Creates an instance of EduEnrollmentProperties class. + */ + public EduEnrollmentProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the domains property: The domain groups associated with this enrollment. + * + * @return the domains value. + */ + public List domains() { + return this.domains; + } + + /** + * Set the domains property: The domain groups associated with this enrollment. + * + * @param domains the domains value to set. + * @return the EduEnrollmentProperties object itself. + */ + public EduEnrollmentProperties withDomains(List domains) { + this.domains = domains; + return this; + } + + /** + * Get the failureReason property: Failure detail when provisioningState is Failed. Omitted otherwise. + * + * @return the failureReason value. + */ + public ManagementError failureReason() { + return this.failureReason; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("domains", this.domains, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EduEnrollmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EduEnrollmentProperties 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 EduEnrollmentProperties. + */ + public static EduEnrollmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EduEnrollmentProperties deserializedEduEnrollmentProperties = new EduEnrollmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domains".equals(fieldName)) { + List domains = reader.readArray(reader1 -> DomainGroup.fromJson(reader1)); + deserializedEduEnrollmentProperties.domains = domains; + } else if ("provisioningState".equals(fieldName)) { + deserializedEduEnrollmentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("failureReason".equals(fieldName)) { + deserializedEduEnrollmentProperties.failureReason = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEduEnrollmentProperties; + }); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollments.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollments.java new file mode 100644 index 000000000000..045ac8393dd7 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollments.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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 EduEnrollments. + */ +public interface EduEnrollments { + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @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 EduEnrollment along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, + Context context); + + /** + * Get a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment. + */ + EduEnrollment getByResourceGroup(String resourceGroupName, String enrollmentName); + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String enrollmentName, Context context); + + /** + * Delete a EduEnrollment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enrollmentName The name of the edu enrollment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 enrollmentName); + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EduEnrollment resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EduEnrollment resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List EduEnrollment resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EduEnrollment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a EduEnrollment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment along with {@link Response}. + */ + EduEnrollment getById(String id); + + /** + * Get a EduEnrollment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EduEnrollment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a EduEnrollment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a EduEnrollment. + * + * @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 the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EduEnrollment resource. + * + * @param name resource name. + * @return the first stage of the new EduEnrollment definition. + */ + EduEnrollment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Operation.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Operation.java new file mode 100644 index 000000000000..876ac412bec4 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.models; + +import com.azure.resourcemanager.programenrollment.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.programenrollment.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/OperationDisplay.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/OperationDisplay.java new file mode 100644 index 000000000000..b354cf941f6e --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Operations.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Operations.java new file mode 100644 index 000000000000..42f570ec76df --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Origin.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/Origin.java new file mode 100644 index 000000000000..07acbb2e21f4 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/ProvisioningState.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/ProvisioningState.java new file mode 100644 index 000000000000..ae2e63ad4c74 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/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.programenrollment.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +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"); + + /** + * Initial provisioning in progress. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Update in progress. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Deletion in progress. + */ + 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/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/package-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/package-info.java new file mode 100644 index 000000000000..95f0c8bc6be7 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ProgramEnrollment. + */ +package com.azure.resourcemanager.programenrollment.models; diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/package-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/package-info.java new file mode 100644 index 000000000000..79cbcab32c90 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/com/azure/resourcemanager/programenrollment/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ProgramEnrollment. + */ +package com.azure.resourcemanager.programenrollment; diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/module-info.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/java/module-info.java new file mode 100644 index 000000000000..853824fbc0e5 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/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.programenrollment { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.programenrollment; + exports com.azure.resourcemanager.programenrollment.fluent; + exports com.azure.resourcemanager.programenrollment.fluent.models; + exports com.azure.resourcemanager.programenrollment.models; + + opens com.azure.resourcemanager.programenrollment.fluent.models to com.azure.core; + opens com.azure.resourcemanager.programenrollment.models to com.azure.core; + opens com.azure.resourcemanager.programenrollment.implementation.models to com.azure.core; +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/azure-resourcemanager-programenrollment_metadata.json b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/azure-resourcemanager-programenrollment_metadata.json new file mode 100644 index 000000000000..0c9c0d0981f7 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/azure-resourcemanager-programenrollment_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.ProgramEnrollment":"2026-03-01-preview"},"crossLanguagePackageId":"Microsoft.ProgramEnrollment","crossLanguageVersion":"664774a28ba3","crossLanguageDefinitions":{"com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient":"Microsoft.ProgramEnrollment.EduEnrollments","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.beginCreateOrUpdate":"Microsoft.ProgramEnrollment.EduEnrollments.createOrUpdate","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.createOrUpdate":"Microsoft.ProgramEnrollment.EduEnrollments.createOrUpdate","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.delete":"Microsoft.ProgramEnrollment.EduEnrollments.delete","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.deleteWithResponse":"Microsoft.ProgramEnrollment.EduEnrollments.delete","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.getByResourceGroup":"Microsoft.ProgramEnrollment.EduEnrollments.get","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.getByResourceGroupWithResponse":"Microsoft.ProgramEnrollment.EduEnrollments.get","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.list":"Microsoft.ProgramEnrollment.EduEnrollments.listBySubscription","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.listByResourceGroup":"Microsoft.ProgramEnrollment.EduEnrollments.listByResourceGroup","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.update":"Microsoft.ProgramEnrollment.EduEnrollments.update","com.azure.resourcemanager.programenrollment.fluent.EduEnrollmentsClient.updateWithResponse":"Microsoft.ProgramEnrollment.EduEnrollments.update","com.azure.resourcemanager.programenrollment.fluent.OperationsClient":"Microsoft.ProgramEnrollment.Operations","com.azure.resourcemanager.programenrollment.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.programenrollment.fluent.ProgramEnrollmentManagementClient":"Microsoft.ProgramEnrollment","com.azure.resourcemanager.programenrollment.fluent.models.EduEnrollmentInner":"Microsoft.ProgramEnrollment.EduEnrollment","com.azure.resourcemanager.programenrollment.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.programenrollment.implementation.ProgramEnrollmentManagementClientBuilder":"Microsoft.ProgramEnrollment","com.azure.resourcemanager.programenrollment.implementation.models.EduEnrollmentListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.programenrollment.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.programenrollment.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.programenrollment.models.DomainGroup":"Microsoft.ProgramEnrollment.DomainGroup","com.azure.resourcemanager.programenrollment.models.DomainGroupState":"Microsoft.ProgramEnrollment.DomainGroupState","com.azure.resourcemanager.programenrollment.models.EduEnrollmentPatch":"Microsoft.ProgramEnrollment.EduEnrollmentPatch","com.azure.resourcemanager.programenrollment.models.EduEnrollmentProperties":"Microsoft.ProgramEnrollment.EduEnrollmentProperties","com.azure.resourcemanager.programenrollment.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.programenrollment.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.programenrollment.models.ProvisioningState":"Microsoft.ProgramEnrollment.ProvisioningState"},"generatedFiles":["src/main/java/com/azure/resourcemanager/programenrollment/ProgramEnrollmentManager.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/EduEnrollmentsClient.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/ProgramEnrollmentManagementClient.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/EduEnrollmentInner.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/programenrollment/fluent/package-info.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsClientImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/EduEnrollmentsImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/ProgramEnrollmentManagementClientImpl.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/EduEnrollmentListResult.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/programenrollment/implementation/package-info.java","src/main/java/com/azure/resourcemanager/programenrollment/models/ActionType.java","src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroup.java","src/main/java/com/azure/resourcemanager/programenrollment/models/DomainGroupState.java","src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollment.java","src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentPatch.java","src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollmentProperties.java","src/main/java/com/azure/resourcemanager/programenrollment/models/EduEnrollments.java","src/main/java/com/azure/resourcemanager/programenrollment/models/Operation.java","src/main/java/com/azure/resourcemanager/programenrollment/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/programenrollment/models/Operations.java","src/main/java/com/azure/resourcemanager/programenrollment/models/Origin.java","src/main/java/com/azure/resourcemanager/programenrollment/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/programenrollment/models/package-info.java","src/main/java/com/azure/resourcemanager/programenrollment/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/proxy-config.json b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/proxy-config.json new file mode 100644 index 000000000000..020524fc4e8b --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.programenrollment.implementation.EduEnrollmentsClientImpl$EduEnrollmentsService"],["com.azure.resourcemanager.programenrollment.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/reflect-config.json b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-programenrollment/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/azure-resourcemanager-programenrollment.properties b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/azure-resourcemanager-programenrollment.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/main/resources/azure-resourcemanager-programenrollment.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsCreateOrUpdateSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1bc2a11c6ee8 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.generated; + +import com.azure.resourcemanager.programenrollment.models.DomainGroup; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentProperties; +import java.util.Arrays; + +/** + * Samples for EduEnrollments CreateOrUpdate. + */ +public final class EduEnrollmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_CreateOrUpdate.json + */ + /** + * Sample code: Create or update an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + createOrUpdateAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments() + .define("default") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new EduEnrollmentProperties().withDomains( + Arrays.asList(new DomainGroup().withDomainNames(Arrays.asList("university.edu", "college.edu")) + .withTenantId("00000000-0000-0000-0000-000000000001")))) + .create(); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteSamples.java new file mode 100644 index 000000000000..7ed534df8554 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteSamples.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.programenrollment.generated; + +/** + * Samples for EduEnrollments Delete. + */ +public final class EduEnrollmentsDeleteSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Delete.json + */ + /** + * Sample code: Delete an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + deleteAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments() + .deleteByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsGetByResourceGroupSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..e9c76b3985de --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsGetByResourceGroupSamples.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.programenrollment.generated; + +/** + * Samples for EduEnrollments GetByResourceGroup. + */ +public final class EduEnrollmentsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Get.json + */ + /** + * Sample code: Get an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + getAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().getByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListByResourceGroupSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListByResourceGroupSamples.java new file mode 100644 index 000000000000..f8b82b9ea437 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListByResourceGroupSamples.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.programenrollment.generated; + +/** + * Samples for EduEnrollments ListByResourceGroup. + */ +public final class EduEnrollmentsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_ListByResourceGroup.json + */ + /** + * Sample code: List edu enrollments by resource group. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void listEduEnrollmentsByResourceGroup( + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListSamples.java new file mode 100644 index 000000000000..5c8347d5a676 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsListSamples.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.programenrollment.generated; + +/** + * Samples for EduEnrollments List. + */ +public final class EduEnrollmentsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_ListBySubscription.json + */ + /** + * Sample code: List edu enrollments by subscription. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + listEduEnrollmentsBySubscription(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.eduEnrollments().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsUpdateSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsUpdateSamples.java new file mode 100644 index 000000000000..da257dd9d839 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsUpdateSamples.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.programenrollment.generated; + +import com.azure.resourcemanager.programenrollment.models.EduEnrollment; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EduEnrollments Update. + */ +public final class EduEnrollmentsUpdateSamples { + /* + * x-ms-original-file: 2026-03-01-preview/EduEnrollments_Update.json + */ + /** + * Sample code: Update an edu enrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void + updateAnEduEnrollment(com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + EduEnrollment resource = manager.eduEnrollments() + .getByResourceGroupWithResponse("testrg", "default", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("env", "test")).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/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/OperationsListSamples.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/generated/OperationsListSamples.java new file mode 100644 index 000000000000..69efafee9d62 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/samples/java/com/azure/resourcemanager/programenrollment/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.programenrollment.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-03-01-preview/Operations_List.json + */ + /** + * Sample code: List operations for Microsoft.ProgramEnrollment. + * + * @param manager Entry point to ProgramEnrollmentManager. + */ + public static void listOperationsForMicrosoftProgramEnrollment( + com.azure.resourcemanager.programenrollment.ProgramEnrollmentManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentPatchTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentPatchTests.java new file mode 100644 index 000000000000..499c35ef29f5 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentPatchTests.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.programenrollment.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programenrollment.models.EduEnrollmentPatch; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EduEnrollmentPatchTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EduEnrollmentPatch model + = BinaryData.fromString("{\"tags\":{\"xj\":\"mqnjaqw\",\"atscmd\":\"prozvcputegjvwmf\"}}") + .toObject(EduEnrollmentPatch.class); + Assertions.assertEquals("mqnjaqw", model.tags().get("xj")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EduEnrollmentPatch model + = new EduEnrollmentPatch().withTags(mapOf("xj", "mqnjaqw", "atscmd", "prozvcputegjvwmf")); + model = BinaryData.fromObject(model).toObject(EduEnrollmentPatch.class); + Assertions.assertEquals("mqnjaqw", model.tags().get("xj")); + } + + // 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/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteByResourceGroupWithResponseMockTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..35e60e5a4775 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/EduEnrollmentsDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.programenrollment.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.programenrollment.ProgramEnrollmentManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EduEnrollmentsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ProgramEnrollmentManager manager = ProgramEnrollmentManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.eduEnrollments() + .deleteByResourceGroupWithResponse("lssai", "qpjwnzlljfm", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationDisplayTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..b6b2a472633b --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/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.programenrollment.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationInnerTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationInnerTests.java new file mode 100644 index 000000000000..7cfc68b8d659 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/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.programenrollment.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationListResultTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationListResultTests.java new file mode 100644 index 000000000000..a5e71b6e03da --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/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.programenrollment.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.programenrollment.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/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationsListMockTests.java b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..824b1103836a --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/src/test/java/com/azure/resourcemanager/programenrollment/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.programenrollment.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.programenrollment.ProgramEnrollmentManager; +import com.azure.resourcemanager.programenrollment.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\":\"si\",\"isDataAction\":true,\"display\":{\"provider\":\"ciqihnhung\",\"resource\":\"jzrnf\",\"operation\":\"xgispemvtzfkufu\",\"description\":\"jofxqe\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ProgramEnrollmentManager manager = ProgramEnrollmentManager.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/programenrollment/azure-resourcemanager-programenrollment/tsp-location.yaml b/sdk/programenrollment/azure-resourcemanager-programenrollment/tsp-location.yaml new file mode 100644 index 000000000000..e8bbd78c33b3 --- /dev/null +++ b/sdk/programenrollment/azure-resourcemanager-programenrollment/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/programenrollment/resource-manager/Microsoft.ProgramEnrollment/ProgramEnrollment +commit: 8be35e606b4149f3d8fa519c8cd5b37a9b0c22bd +repo: Azure/azure-rest-api-specs-pr +additionalDirectories: diff --git a/sdk/programenrollment/ci.yml b/sdk/programenrollment/ci.yml new file mode 100644 index 000000000000..ee913f24b452 --- /dev/null +++ b/sdk/programenrollment/ci.yml @@ -0,0 +1,41 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/programenrollment/ci.yml + - sdk/programenrollment/azure-resourcemanager-programenrollment/ + exclude: + - sdk/programenrollment/pom.xml + - sdk/programenrollment/azure-resourcemanager-programenrollment/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/programenrollment/ci.yml + - sdk/programenrollment/azure-resourcemanager-programenrollment/ + exclude: + - sdk/programenrollment/pom.xml + - sdk/programenrollment/azure-resourcemanager-programenrollment/pom.xml + +parameters: [] + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: programenrollment + Artifacts: + - name: azure-resourcemanager-programenrollment + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerprogramenrollment diff --git a/sdk/programenrollment/pom.xml b/sdk/programenrollment/pom.xml new file mode 100644 index 000000000000..2e28a5f9f1c0 --- /dev/null +++ b/sdk/programenrollment/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-programenrollment-service + pom + 1.0.0 + + + azure-resourcemanager-programenrollment + + \ No newline at end of file