diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 75b2a218daf9..815cd31e56c4 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -517,6 +517,7 @@ com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-computelimit;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-managedops;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 6c9d431da122..f0c911b263f4 100644 --- a/pom.xml +++ b/pom.xml @@ -155,6 +155,7 @@ sdk/maintenance sdk/managedapplications sdk/managednetworkfabric + sdk/managedops sdk/managementgroups sdk/maps sdk/mariadb diff --git a/sdk/managedops/azure-resourcemanager-managedops/CHANGELOG.md b/sdk/managedops/azure-resourcemanager-managedops/CHANGELOG.md new file mode 100644 index 000000000000..edc985816663 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-01-23) + +- Azure Resource Manager ManagedOps client library for Java. This package contains Microsoft Azure SDK for ManagedOps Management SDK. Managed Operations API. Package api-version 2025-07-28-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-managedops Java SDK. diff --git a/sdk/managedops/azure-resourcemanager-managedops/README.md b/sdk/managedops/azure-resourcemanager-managedops/README.md new file mode 100644 index 000000000000..55b6a0115254 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ManagedOps client library for Java + +Azure Resource Manager ManagedOps client library for Java. + +This package contains Microsoft Azure SDK for ManagedOps Management SDK. Managed Operations API. Package api-version 2025-07-28-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-managedops;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-managedops + 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(); +ManagedOpsManager manager = ManagedOpsManager + .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/managedops/azure-resourcemanager-managedops/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/managedops/azure-resourcemanager-managedops/SAMPLE.md b/sdk/managedops/azure-resourcemanager-managedops/SAMPLE.md new file mode 100644 index 000000000000..652dab56f77c --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/SAMPLE.md @@ -0,0 +1,158 @@ +# Code snippets and samples + + +## ManagedOps + +- [CreateOrUpdate](#managedops_createorupdate) +- [Delete](#managedops_delete) +- [Get](#managedops_get) +- [List](#managedops_list) +- [Update](#managedops_update) + +## Operations + +- [List](#operations_list) +### ManagedOps_CreateOrUpdate + +```java +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; + +/** + * Samples for ManagedOps CreateOrUpdate. + */ +public final class ManagedOpsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_CreateOrUpdate.json + */ + /** + * Sample code: ManagedOps_CreateOrUpdate. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsCreateOrUpdate(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps() + .define("default") + .withProperties(new ManagedOpsProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory(new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/00000000-0000-0000-0000-000000000000-Default")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/example")) + .withUserAssignedManagedIdentityId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myManagedIdentity"))) + .create(); + } +} +``` + +### ManagedOps_Delete + +```java +/** + * Samples for ManagedOps Delete. + */ +public final class ManagedOpsDeleteSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Delete.json + */ + /** + * Sample code: ManagedOps_Delete. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsDelete(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().delete("default", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedOps_Get + +```java +/** + * Samples for ManagedOps Get. + */ +public final class ManagedOpsGetSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Get.json + */ + /** + * Sample code: ManagedOps_Get. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsGet(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().getWithResponse("default", com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedOps_List + +```java +/** + * Samples for ManagedOps List. + */ +public final class ManagedOpsListSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_List.json + */ + /** + * Sample code: ManagedOps_List. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsList(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ManagedOps_Update + +```java +import com.azure.resourcemanager.managedops.models.ManagedOp; + +/** + * Samples for ManagedOps Update. + */ +public final class ManagedOpsUpdateSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Update.json + */ + /** + * Sample code: ManagedOps_Update. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsUpdate(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + ManagedOp resource + = manager.managedOps().getWithResponse("default", com.azure.core.util.Context.NONE).getValue(); + resource.update().apply(); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-07-28-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void operationsList(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/managedops/azure-resourcemanager-managedops/pom.xml b/sdk/managedops/azure-resourcemanager-managedops/pom.xml new file mode 100644 index 000000000000..9f9070c152ff --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/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-managedops + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ManagedOps Management + This package contains Microsoft Azure SDK for ManagedOps Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Managed Operations API. Package api-version 2025-07-28-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.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/ManagedOpsManager.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/ManagedOpsManager.java new file mode 100644 index 000000000000..18cc5a486bf3 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/ManagedOpsManager.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops; + +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.managedops.fluent.ManagedOpsManagementClient; +import com.azure.resourcemanager.managedops.implementation.ManagedOpsImpl; +import com.azure.resourcemanager.managedops.implementation.ManagedOpsManagementClientBuilder; +import com.azure.resourcemanager.managedops.implementation.OperationsImpl; +import com.azure.resourcemanager.managedops.models.ManagedOps; +import com.azure.resourcemanager.managedops.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 ManagedOpsManager. + * Managed Operations API. + */ +public final class ManagedOpsManager { + private Operations operations; + + private ManagedOps managedOps; + + private final ManagedOpsManagementClient clientObject; + + private ManagedOpsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ManagedOpsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ManagedOps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedOps service API instance. + */ + public static ManagedOpsManager 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 ManagedOps service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ManagedOps service API instance. + */ + public static ManagedOpsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ManagedOpsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ManagedOpsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagedOpsManager.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-managedops.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 ManagedOps service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedOps service API instance. + */ + public ManagedOpsManager 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.managedops") + .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 ManagedOpsManager(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 ManagedOps. It manages ManagedOp. + * + * @return Resource collection API of ManagedOps. + */ + public ManagedOps managedOps() { + if (this.managedOps == null) { + this.managedOps = new ManagedOpsImpl(clientObject.getManagedOps(), this); + } + return managedOps; + } + + /** + * Gets wrapped service client ManagedOpsManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client ManagedOpsManagementClient. + */ + public ManagedOpsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsClient.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsClient.java new file mode 100644 index 000000000000..6f93d8083c68 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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.managedops.fluent.models.ManagedOpInner; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdate; + +/** + * An instance of this class provides access to all the operations defined in ManagedOpsClient. + */ +public interface ManagedOpsClient { + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String managedOpsName, Context context); + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedOpInner get(String managedOpsName); + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedOpInner> beginCreateOrUpdate(String managedOpsName, + ManagedOpInner resource); + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedOpInner> beginCreateOrUpdate(String managedOpsName, + ManagedOpInner resource, Context context); + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedOpInner createOrUpdate(String managedOpsName, ManagedOpInner resource); + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedOpInner createOrUpdate(String managedOpsName, ManagedOpInner resource, Context context); + + /** + * List all ManagedOps instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all ManagedOps instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedOpInner> beginUpdate(String managedOpsName, + ManagedOpUpdate properties); + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedOpInner> beginUpdate(String managedOpsName, + ManagedOpUpdate properties, Context context); + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedOpInner update(String managedOpsName, ManagedOpUpdate properties); + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedOpInner update(String managedOpsName, ManagedOpUpdate properties, Context context); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String managedOpsName); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String managedOpsName, Context context); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String managedOpsName); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String managedOpsName, Context context); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsManagementClient.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsManagementClient.java new file mode 100644 index 000000000000..71cff50bcf2b --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsManagementClient.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.managedops.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ManagedOpsManagementClient class. + */ +public interface ManagedOpsManagementClient { + /** + * 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 ManagedOpsClient object to access its operations. + * + * @return the ManagedOpsClient object. + */ + ManagedOpsClient getManagedOps(); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/OperationsClient.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/OperationsClient.java new file mode 100644 index 000000000000..8bc63bf1f000 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/ManagedOpInner.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/ManagedOpInner.java new file mode 100644 index 000000000000..a99c3fcd29ac --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/ManagedOpInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; +import java.io.IOException; + +/** + * The Managed Operations resource. + */ +@Fluent +public final class ManagedOpInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ManagedOpsProperties 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 ManagedOpInner class. + */ + public ManagedOpInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ManagedOpsProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ManagedOpInner object itself. + */ + public ManagedOpInner withProperties(ManagedOpsProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOpInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOpInner 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 ManagedOpInner. + */ + public static ManagedOpInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOpInner deserializedManagedOpInner = new ManagedOpInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedOpInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedOpInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedOpInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedManagedOpInner.properties = ManagedOpsProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedManagedOpInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOpInner; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/OperationInner.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/OperationInner.java new file mode 100644 index 000000000000..d7d166daec26 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.models.ActionType; +import com.azure.resourcemanager.managedops.models.OperationDisplay; +import com.azure.resourcemanager.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/package-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/package-info.java new file mode 100644 index 000000000000..623bdf01c637 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ManagedOpsManagementClient. + * Managed Operations API. + */ +package com.azure.resourcemanager.managedops.fluent.models; diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/package-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/package-info.java new file mode 100644 index 000000000000..945d9fa96f4d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ManagedOpsManagementClient. + * Managed Operations API. + */ +package com.azure.resourcemanager.managedops.fluent; diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpImpl.java new file mode 100644 index 000000000000..b3d65e1a29c7 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner; +import com.azure.resourcemanager.managedops.models.ManagedOp; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdate; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdateProperties; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; + +public final class ManagedOpImpl implements ManagedOp, ManagedOp.Definition, ManagedOp.Update { + private ManagedOpInner innerObject; + + private final com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedOpsProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ManagedOpInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedops.ManagedOpsManager manager() { + return this.serviceManager; + } + + private String managedOpsName; + + private ManagedOpUpdate updateProperties; + + public ManagedOp create() { + this.innerObject = serviceManager.serviceClient() + .getManagedOps() + .createOrUpdate(managedOpsName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedOp create(Context context) { + this.innerObject + = serviceManager.serviceClient().getManagedOps().createOrUpdate(managedOpsName, this.innerModel(), context); + return this; + } + + ManagedOpImpl(String name, com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager) { + this.innerObject = new ManagedOpInner(); + this.serviceManager = serviceManager; + this.managedOpsName = name; + } + + public ManagedOpImpl update() { + this.updateProperties = new ManagedOpUpdate(); + return this; + } + + public ManagedOp apply() { + this.innerObject + = serviceManager.serviceClient().getManagedOps().update(managedOpsName, updateProperties, Context.NONE); + return this; + } + + public ManagedOp apply(Context context) { + this.innerObject + = serviceManager.serviceClient().getManagedOps().update(managedOpsName, updateProperties, context); + return this; + } + + ManagedOpImpl(ManagedOpInner innerObject, com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.managedOpsName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedOps"); + } + + public ManagedOp refresh() { + this.innerObject + = serviceManager.serviceClient().getManagedOps().getWithResponse(managedOpsName, Context.NONE).getValue(); + return this; + } + + public ManagedOp refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getManagedOps().getWithResponse(managedOpsName, context).getValue(); + return this; + } + + public ManagedOpImpl withProperties(ManagedOpsProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ManagedOpImpl withProperties(ManagedOpUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsClientImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsClientImpl.java new file mode 100644 index 000000000000..735bf8bf9d50 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsClientImpl.java @@ -0,0 +1,840 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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.managedops.fluent.ManagedOpsClient; +import com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner; +import com.azure.resourcemanager.managedops.implementation.models.ManagedOpListResult; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdate; +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 ManagedOpsClient. + */ +public final class ManagedOpsClientImpl implements ManagedOpsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ManagedOpsService service; + + /** + * The service client containing this operation class. + */ + private final ManagedOpsManagementClientImpl client; + + /** + * Initializes an instance of ManagedOpsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedOpsClientImpl(ManagedOpsManagementClientImpl client) { + this.service + = RestProxy.create(ManagedOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedOpsManagementClientManagedOps to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ManagedOpsManagementClientManagedOps") + public interface ManagedOpsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ManagedOpInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ManagedOpInner resource, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps") + @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.ManagedOps/managedOps") + @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); + + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ManagedOpUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ManagedOpUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("managedOpsName") String managedOpsName, 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); + } + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String managedOpsName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String managedOpsName) { + return getWithResponseAsync(managedOpsName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String managedOpsName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + managedOpsName, accept, context); + } + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedOpInner get(String managedOpsName) { + return getWithResponse(managedOpsName, Context.NONE).getValue(); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String managedOpsName, + ManagedOpInner 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(), managedOpsName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String managedOpsName, ManagedOpInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, contentType, accept, resource, Context.NONE); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String managedOpsName, ManagedOpInner 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(), managedOpsName, contentType, accept, resource, context); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedOpInner> beginCreateOrUpdateAsync(String managedOpsName, + ManagedOpInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(managedOpsName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedOpInner.class, ManagedOpInner.class, this.client.getContext()); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedOpInner> beginCreateOrUpdate(String managedOpsName, + ManagedOpInner resource) { + Response response = createOrUpdateWithResponse(managedOpsName, resource); + return this.client.getLroResult(response, ManagedOpInner.class, + ManagedOpInner.class, Context.NONE); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedOpInner> beginCreateOrUpdate(String managedOpsName, + ManagedOpInner resource, Context context) { + Response response = createOrUpdateWithResponse(managedOpsName, resource, context); + return this.client.getLroResult(response, ManagedOpInner.class, + ManagedOpInner.class, context); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String managedOpsName, ManagedOpInner resource) { + return beginCreateOrUpdateAsync(managedOpsName, resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedOpInner createOrUpdate(String managedOpsName, ManagedOpInner resource) { + return beginCreateOrUpdate(managedOpsName, resource).getFinalResult(); + } + + /** + * Creates or updates the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedOpInner createOrUpdate(String managedOpsName, ManagedOpInner resource, Context context) { + return beginCreateOrUpdate(managedOpsName, resource, context).getFinalResult(); + } + + /** + * List all ManagedOps instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp 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 all ManagedOps instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all ManagedOps instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp 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 all ManagedOps instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp 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 all ManagedOps instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List all ManagedOps instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String managedOpsName, + ManagedOpUpdate 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(), managedOpsName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String managedOpsName, ManagedOpUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, contentType, accept, properties, Context.NONE); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String managedOpsName, ManagedOpUpdate 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(), managedOpsName, contentType, accept, properties, context); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedOpInner> beginUpdateAsync(String managedOpsName, + ManagedOpUpdate properties) { + Mono>> mono = updateWithResponseAsync(managedOpsName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ManagedOpInner.class, ManagedOpInner.class, this.client.getContext()); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedOpInner> beginUpdate(String managedOpsName, + ManagedOpUpdate properties) { + Response response = updateWithResponse(managedOpsName, properties); + return this.client.getLroResult(response, ManagedOpInner.class, + ManagedOpInner.class, Context.NONE); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedOpInner> beginUpdate(String managedOpsName, + ManagedOpUpdate properties, Context context) { + Response response = updateWithResponse(managedOpsName, properties, context); + return this.client.getLroResult(response, ManagedOpInner.class, + ManagedOpInner.class, context); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String managedOpsName, ManagedOpUpdate properties) { + return beginUpdateAsync(managedOpsName, properties).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedOpInner update(String managedOpsName, ManagedOpUpdate properties) { + return beginUpdate(managedOpsName, properties).getFinalResult(); + } + + /** + * Updates the ManagedOps instance with the supplied fields. + * + * @param managedOpsName Name of the resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Managed Operations resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedOpInner update(String managedOpsName, ManagedOpUpdate properties, Context context) { + return beginUpdate(managedOpsName, properties, context).getFinalResult(); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String managedOpsName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String managedOpsName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, Context.NONE); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String managedOpsName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), managedOpsName, context); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String managedOpsName) { + Mono>> mono = deleteWithResponseAsync(managedOpsName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String managedOpsName) { + Response response = deleteWithResponse(managedOpsName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String managedOpsName, Context context) { + Response response = deleteWithResponse(managedOpsName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String managedOpsName) { + return beginDeleteAsync(managedOpsName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String managedOpsName) { + beginDelete(managedOpsName).getFinalResult(); + } + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String managedOpsName, Context context) { + beginDelete(managedOpsName, context).getFinalResult(); + } + + /** + * 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 ManagedOp list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsImpl.java new file mode 100644 index 000000000000..111868d6c90e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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.managedops.fluent.ManagedOpsClient; +import com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner; +import com.azure.resourcemanager.managedops.models.ManagedOp; +import com.azure.resourcemanager.managedops.models.ManagedOps; + +public final class ManagedOpsImpl implements ManagedOps { + private static final ClientLogger LOGGER = new ClientLogger(ManagedOpsImpl.class); + + private final ManagedOpsClient innerClient; + + private final com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager; + + public ManagedOpsImpl(ManagedOpsClient innerClient, + com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String managedOpsName, Context context) { + Response inner = this.serviceClient().getWithResponse(managedOpsName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ManagedOpImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedOp get(String managedOpsName) { + ManagedOpInner inner = this.serviceClient().get(managedOpsName); + if (inner != null) { + return new ManagedOpImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedOpImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ManagedOpImpl(inner1, this.manager())); + } + + public void delete(String managedOpsName) { + this.serviceClient().delete(managedOpsName); + } + + public void delete(String managedOpsName, Context context) { + this.serviceClient().delete(managedOpsName, context); + } + + public ManagedOp getById(String id) { + String managedOpsName = ResourceManagerUtils.getValueFromIdByName(id, "managedOps"); + if (managedOpsName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedOps'.", id))); + } + return this.getWithResponse(managedOpsName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String managedOpsName = ResourceManagerUtils.getValueFromIdByName(id, "managedOps"); + if (managedOpsName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedOps'.", id))); + } + return this.getWithResponse(managedOpsName, context); + } + + public void deleteById(String id) { + String managedOpsName = ResourceManagerUtils.getValueFromIdByName(id, "managedOps"); + if (managedOpsName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedOps'.", id))); + } + this.delete(managedOpsName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String managedOpsName = ResourceManagerUtils.getValueFromIdByName(id, "managedOps"); + if (managedOpsName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'managedOps'.", id))); + } + this.delete(managedOpsName, context); + } + + private ManagedOpsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedops.ManagedOpsManager manager() { + return this.serviceManager; + } + + public ManagedOpImpl define(String name) { + return new ManagedOpImpl(name, this.manager()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientBuilder.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientBuilder.java new file mode 100644 index 000000000000..33d8c555069d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientBuilder.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.managedops.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 ManagedOpsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ManagedOpsManagementClientImpl.class }) +public final class ManagedOpsManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder 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 ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder 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 ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder 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 ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder 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 ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder 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 ManagedOpsManagementClientBuilder. + */ + public ManagedOpsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagedOpsManagementClientImpl with the provided parameters. + * + * @return an instance of ManagedOpsManagementClientImpl. + */ + public ManagedOpsManagementClientImpl 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(); + ManagedOpsManagementClientImpl client = new ManagedOpsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientImpl.java new file mode 100644 index 000000000000..26dd2517eeee --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientImpl.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.managedops.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.managedops.fluent.ManagedOpsClient; +import com.azure.resourcemanager.managedops.fluent.ManagedOpsManagementClient; +import com.azure.resourcemanager.managedops.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ManagedOpsManagementClientImpl type. + */ +@ServiceClient(builder = ManagedOpsManagementClientBuilder.class) +public final class ManagedOpsManagementClientImpl implements ManagedOpsManagementClient { + /** + * 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 ManagedOpsClient object to access its operations. + */ + private final ManagedOpsClient managedOps; + + /** + * Gets the ManagedOpsClient object to access its operations. + * + * @return the ManagedOpsClient object. + */ + public ManagedOpsClient getManagedOps() { + return this.managedOps; + } + + /** + * Initializes an instance of ManagedOpsManagementClient 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. + */ + ManagedOpsManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-07-28-preview"; + this.operations = new OperationsClientImpl(this); + this.managedOps = new ManagedOpsClientImpl(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(ManagedOpsManagementClientImpl.class); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationImpl.java new file mode 100644 index 000000000000..5fbfdb80173e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.implementation; + +import com.azure.resourcemanager.managedops.fluent.models.OperationInner; +import com.azure.resourcemanager.managedops.models.ActionType; +import com.azure.resourcemanager.managedops.models.Operation; +import com.azure.resourcemanager.managedops.models.OperationDisplay; +import com.azure.resourcemanager.managedops.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.managedops.ManagedOpsManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.managedops.ManagedOpsManager 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.managedops.ManagedOpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsClientImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..01a8edb055ab --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.fluent.OperationsClient; +import com.azure.resourcemanager.managedops.fluent.models.OperationInner; +import com.azure.resourcemanager.managedops.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 ManagedOpsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagedOpsManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedOpsManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ManagedOpsManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ManagedOps/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.ManagedOps/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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsImpl.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsImpl.java new file mode 100644 index 000000000000..9657568627e1 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.fluent.OperationsClient; +import com.azure.resourcemanager.managedops.fluent.models.OperationInner; +import com.azure.resourcemanager.managedops.models.Operation; +import com.azure.resourcemanager.managedops.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.managedops.ManagedOpsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.managedops.ManagedOpsManager 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.managedops.ManagedOpsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ResourceManagerUtils.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..ffbcd94e778b --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/models/ManagedOpListResult.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/models/ManagedOpListResult.java new file mode 100644 index 000000000000..9e0a4818026e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/models/ManagedOpListResult.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.managedops.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.managedops.fluent.models.ManagedOpInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ManagedOp list operation. + */ +@Immutable +public final class ManagedOpListResult implements JsonSerializable { + /* + * The ManagedOp items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ManagedOpListResult class. + */ + private ManagedOpListResult() { + } + + /** + * Get the value property: The ManagedOp 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 ManagedOpListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOpListResult 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 ManagedOpListResult. + */ + public static ManagedOpListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOpListResult deserializedManagedOpListResult = new ManagedOpListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ManagedOpInner.fromJson(reader1)); + deserializedManagedOpListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedManagedOpListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOpListResult; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/models/OperationListResult.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..8615653d84c9 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/package-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/package-info.java new file mode 100644 index 000000000000..4e8826265649 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ManagedOpsManagementClient. + * Managed Operations API. + */ +package com.azure.resourcemanager.managedops.implementation; diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ActionType.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ActionType.java new file mode 100644 index 000000000000..da13b12a43ed --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorConfiguration.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorConfiguration.java new file mode 100644 index 000000000000..64b64edb1a29 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorConfiguration.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for the Azure Monitor Insights service. + */ +@Fluent +public final class AzureMonitorConfiguration implements JsonSerializable { + /* + * Azure monitor workspace resource ID used by the service. + */ + private String azureMonitorWorkspaceId; + + /** + * Creates an instance of AzureMonitorConfiguration class. + */ + public AzureMonitorConfiguration() { + } + + /** + * Get the azureMonitorWorkspaceId property: Azure monitor workspace resource ID used by the service. + * + * @return the azureMonitorWorkspaceId value. + */ + public String azureMonitorWorkspaceId() { + return this.azureMonitorWorkspaceId; + } + + /** + * Set the azureMonitorWorkspaceId property: Azure monitor workspace resource ID used by the service. + * + * @param azureMonitorWorkspaceId the azureMonitorWorkspaceId value to set. + * @return the AzureMonitorConfiguration object itself. + */ + public AzureMonitorConfiguration withAzureMonitorWorkspaceId(String azureMonitorWorkspaceId) { + this.azureMonitorWorkspaceId = azureMonitorWorkspaceId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureMonitorWorkspaceId", this.azureMonitorWorkspaceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorConfiguration 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 AzureMonitorConfiguration. + */ + public static AzureMonitorConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorConfiguration deserializedAzureMonitorConfiguration = new AzureMonitorConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureMonitorWorkspaceId".equals(fieldName)) { + deserializedAzureMonitorConfiguration.azureMonitorWorkspaceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorConfiguration; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorInformation.java new file mode 100644 index 000000000000..12cdbb6d75ff --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorInformation.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Azure Monitor Insights service information. + */ +@Immutable +public final class AzureMonitorInformation implements JsonSerializable { + /* + * ID of Data Collection Rule (DCR) associated with this service. + */ + private String dcrId; + + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of AzureMonitorInformation class. + */ + private AzureMonitorInformation() { + } + + /** + * Get the dcrId property: ID of Data Collection Rule (DCR) associated with this service. + * + * @return the dcrId value. + */ + public String dcrId() { + return this.dcrId; + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dcrId", this.dcrId); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorInformation 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 AzureMonitorInformation. + */ + public static AzureMonitorInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorInformation deserializedAzureMonitorInformation = new AzureMonitorInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dcrId".equals(fieldName)) { + deserializedAzureMonitorInformation.dcrId = reader.getString(); + } else if ("enablementStatus".equals(fieldName)) { + deserializedAzureMonitorInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingConfiguration.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingConfiguration.java new file mode 100644 index 000000000000..ca8a2a9a57c4 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingConfiguration.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Configuration for the Change Tracking and Inventory service. + */ +@Fluent +public final class ChangeTrackingConfiguration implements JsonSerializable { + /* + * Log analytics workspace resource ID used by the service. + */ + private String logAnalyticsWorkspaceId; + + /** + * Creates an instance of ChangeTrackingConfiguration class. + */ + public ChangeTrackingConfiguration() { + } + + /** + * Get the logAnalyticsWorkspaceId property: Log analytics workspace resource ID used by the service. + * + * @return the logAnalyticsWorkspaceId value. + */ + public String logAnalyticsWorkspaceId() { + return this.logAnalyticsWorkspaceId; + } + + /** + * Set the logAnalyticsWorkspaceId property: Log analytics workspace resource ID used by the service. + * + * @param logAnalyticsWorkspaceId the logAnalyticsWorkspaceId value to set. + * @return the ChangeTrackingConfiguration object itself. + */ + public ChangeTrackingConfiguration withLogAnalyticsWorkspaceId(String logAnalyticsWorkspaceId) { + this.logAnalyticsWorkspaceId = logAnalyticsWorkspaceId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("logAnalyticsWorkspaceId", this.logAnalyticsWorkspaceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChangeTrackingConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChangeTrackingConfiguration 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 ChangeTrackingConfiguration. + */ + public static ChangeTrackingConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChangeTrackingConfiguration deserializedChangeTrackingConfiguration = new ChangeTrackingConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logAnalyticsWorkspaceId".equals(fieldName)) { + deserializedChangeTrackingConfiguration.logAnalyticsWorkspaceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChangeTrackingConfiguration; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformation.java new file mode 100644 index 000000000000..b59c920f6093 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformation.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Change Tracking and Inventory service information. + */ +@Immutable +public final class ChangeTrackingInformation implements JsonSerializable { + /* + * ID of Data Collection Rule (DCR) associated with this service. + */ + private String dcrId; + + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of ChangeTrackingInformation class. + */ + private ChangeTrackingInformation() { + } + + /** + * Get the dcrId property: ID of Data Collection Rule (DCR) associated with this service. + * + * @return the dcrId value. + */ + public String dcrId() { + return this.dcrId; + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dcrId", this.dcrId); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChangeTrackingInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChangeTrackingInformation 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 ChangeTrackingInformation. + */ + public static ChangeTrackingInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChangeTrackingInformation deserializedChangeTrackingInformation = new ChangeTrackingInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dcrId".equals(fieldName)) { + deserializedChangeTrackingInformation.dcrId = reader.getString(); + } else if ("enablementStatus".equals(fieldName)) { + deserializedChangeTrackingInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedChangeTrackingInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformationEnablementStatus.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformationEnablementStatus.java new file mode 100644 index 000000000000..75efb293fe5d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformationEnablementStatus.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.managedops.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ChangeTrackingInformationEnablementStatus. + */ +public final class ChangeTrackingInformationEnablementStatus + extends ExpandableStringEnum { + /** + * Static value Enabled for ChangeTrackingInformationEnablementStatus. + */ + public static final ChangeTrackingInformationEnablementStatus ENABLED = fromString("Enabled"); + + /** + * Static value InProgress for ChangeTrackingInformationEnablementStatus. + */ + public static final ChangeTrackingInformationEnablementStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Failed for ChangeTrackingInformationEnablementStatus. + */ + public static final ChangeTrackingInformationEnablementStatus FAILED = fromString("Failed"); + + /** + * Static value Disabled for ChangeTrackingInformationEnablementStatus. + */ + public static final ChangeTrackingInformationEnablementStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of ChangeTrackingInformationEnablementStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ChangeTrackingInformationEnablementStatus() { + } + + /** + * Creates or finds a ChangeTrackingInformationEnablementStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChangeTrackingInformationEnablementStatus. + */ + public static ChangeTrackingInformationEnablementStatus fromString(String name) { + return fromString(name, ChangeTrackingInformationEnablementStatus.class); + } + + /** + * Gets known ChangeTrackingInformationEnablementStatus values. + * + * @return known ChangeTrackingInformationEnablementStatus values. + */ + public static Collection values() { + return values(ChangeTrackingInformationEnablementStatus.class); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderCspmInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderCspmInformation.java new file mode 100644 index 000000000000..5d4c06353f3e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderCspmInformation.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Defender Cloud Security Posture Management (CSPM) service information. + */ +@Immutable +public final class DefenderCspmInformation implements JsonSerializable { + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of DefenderCspmInformation class. + */ + private DefenderCspmInformation() { + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmInformation 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 DefenderCspmInformation. + */ + public static DefenderCspmInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmInformation deserializedDefenderCspmInformation = new DefenderCspmInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enablementStatus".equals(fieldName)) { + deserializedDefenderCspmInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderForServersInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderForServersInformation.java new file mode 100644 index 000000000000..067aa081dc5d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DefenderForServersInformation.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Defender for Servers service information. + */ +@Immutable +public final class DefenderForServersInformation implements JsonSerializable { + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of DefenderForServersInformation class. + */ + private DefenderForServersInformation() { + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersInformation 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 DefenderForServersInformation. + */ + public static DefenderForServersInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersInformation deserializedDefenderForServersInformation + = new DefenderForServersInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enablementStatus".equals(fieldName)) { + deserializedDefenderForServersInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfiguration.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfiguration.java new file mode 100644 index 000000000000..d1375d54c9e0 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfiguration.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Desired configuration input by the user. + */ +@Fluent +public final class DesiredConfiguration implements JsonSerializable { + /* + * Configuration for the Change Tracking and Inventory service. + */ + private ChangeTrackingConfiguration changeTrackingAndInventory; + + /* + * Configuration for the Azure Monitor Insights service. + */ + private AzureMonitorConfiguration azureMonitorInsights; + + /* + * User assigned Managed Identity used to perform operations on machines managed by Ops360. + */ + private String userAssignedManagedIdentityId; + + /* + * Desired enablement state of the Defender For Servers service. + */ + private DesiredConfigurationDefenderForServers defenderForServers; + + /* + * Desired enablement state of the Defender Cloud Security Posture Management (CSPM) service. + */ + private DesiredConfigurationDefenderForServers defenderCspm; + + /** + * Creates an instance of DesiredConfiguration class. + */ + public DesiredConfiguration() { + } + + /** + * Get the changeTrackingAndInventory property: Configuration for the Change Tracking and Inventory service. + * + * @return the changeTrackingAndInventory value. + */ + public ChangeTrackingConfiguration changeTrackingAndInventory() { + return this.changeTrackingAndInventory; + } + + /** + * Set the changeTrackingAndInventory property: Configuration for the Change Tracking and Inventory service. + * + * @param changeTrackingAndInventory the changeTrackingAndInventory value to set. + * @return the DesiredConfiguration object itself. + */ + public DesiredConfiguration withChangeTrackingAndInventory(ChangeTrackingConfiguration changeTrackingAndInventory) { + this.changeTrackingAndInventory = changeTrackingAndInventory; + return this; + } + + /** + * Get the azureMonitorInsights property: Configuration for the Azure Monitor Insights service. + * + * @return the azureMonitorInsights value. + */ + public AzureMonitorConfiguration azureMonitorInsights() { + return this.azureMonitorInsights; + } + + /** + * Set the azureMonitorInsights property: Configuration for the Azure Monitor Insights service. + * + * @param azureMonitorInsights the azureMonitorInsights value to set. + * @return the DesiredConfiguration object itself. + */ + public DesiredConfiguration withAzureMonitorInsights(AzureMonitorConfiguration azureMonitorInsights) { + this.azureMonitorInsights = azureMonitorInsights; + return this; + } + + /** + * Get the userAssignedManagedIdentityId property: User assigned Managed Identity used to perform operations on + * machines managed by Ops360. + * + * @return the userAssignedManagedIdentityId value. + */ + public String userAssignedManagedIdentityId() { + return this.userAssignedManagedIdentityId; + } + + /** + * Set the userAssignedManagedIdentityId property: User assigned Managed Identity used to perform operations on + * machines managed by Ops360. + * + * @param userAssignedManagedIdentityId the userAssignedManagedIdentityId value to set. + * @return the DesiredConfiguration object itself. + */ + public DesiredConfiguration withUserAssignedManagedIdentityId(String userAssignedManagedIdentityId) { + this.userAssignedManagedIdentityId = userAssignedManagedIdentityId; + return this; + } + + /** + * Get the defenderForServers property: Desired enablement state of the Defender For Servers service. + * + * @return the defenderForServers value. + */ + public DesiredConfigurationDefenderForServers defenderForServers() { + return this.defenderForServers; + } + + /** + * Set the defenderForServers property: Desired enablement state of the Defender For Servers service. + * + * @param defenderForServers the defenderForServers value to set. + * @return the DesiredConfiguration object itself. + */ + public DesiredConfiguration withDefenderForServers(DesiredConfigurationDefenderForServers defenderForServers) { + this.defenderForServers = defenderForServers; + return this; + } + + /** + * Get the defenderCspm property: Desired enablement state of the Defender Cloud Security Posture Management (CSPM) + * service. + * + * @return the defenderCspm value. + */ + public DesiredConfigurationDefenderForServers defenderCspm() { + return this.defenderCspm; + } + + /** + * Set the defenderCspm property: Desired enablement state of the Defender Cloud Security Posture Management (CSPM) + * service. + * + * @param defenderCspm the defenderCspm value to set. + * @return the DesiredConfiguration object itself. + */ + public DesiredConfiguration withDefenderCspm(DesiredConfigurationDefenderForServers defenderCspm) { + this.defenderCspm = defenderCspm; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("changeTrackingAndInventory", this.changeTrackingAndInventory); + jsonWriter.writeJsonField("azureMonitorInsights", this.azureMonitorInsights); + jsonWriter.writeStringField("userAssignedManagedIdentityId", this.userAssignedManagedIdentityId); + jsonWriter.writeStringField("defenderForServers", + this.defenderForServers == null ? null : this.defenderForServers.toString()); + jsonWriter.writeStringField("defenderCspm", this.defenderCspm == null ? null : this.defenderCspm.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DesiredConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DesiredConfiguration 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 DesiredConfiguration. + */ + public static DesiredConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DesiredConfiguration deserializedDesiredConfiguration = new DesiredConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("changeTrackingAndInventory".equals(fieldName)) { + deserializedDesiredConfiguration.changeTrackingAndInventory + = ChangeTrackingConfiguration.fromJson(reader); + } else if ("azureMonitorInsights".equals(fieldName)) { + deserializedDesiredConfiguration.azureMonitorInsights = AzureMonitorConfiguration.fromJson(reader); + } else if ("userAssignedManagedIdentityId".equals(fieldName)) { + deserializedDesiredConfiguration.userAssignedManagedIdentityId = reader.getString(); + } else if ("defenderForServers".equals(fieldName)) { + deserializedDesiredConfiguration.defenderForServers + = DesiredConfigurationDefenderForServers.fromString(reader.getString()); + } else if ("defenderCspm".equals(fieldName)) { + deserializedDesiredConfiguration.defenderCspm + = DesiredConfigurationDefenderForServers.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDesiredConfiguration; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfigurationDefenderForServers.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfigurationDefenderForServers.java new file mode 100644 index 000000000000..db1215433a08 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfigurationDefenderForServers.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for DesiredConfigurationDefenderForServers. + */ +public final class DesiredConfigurationDefenderForServers + extends ExpandableStringEnum { + /** + * Static value Enable for DesiredConfigurationDefenderForServers. + */ + public static final DesiredConfigurationDefenderForServers ENABLE = fromString("Enable"); + + /** + * Static value Disable for DesiredConfigurationDefenderForServers. + */ + public static final DesiredConfigurationDefenderForServers DISABLE = fromString("Disable"); + + /** + * Creates a new instance of DesiredConfigurationDefenderForServers value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DesiredConfigurationDefenderForServers() { + } + + /** + * Creates or finds a DesiredConfigurationDefenderForServers from its string representation. + * + * @param name a name to look for. + * @return the corresponding DesiredConfigurationDefenderForServers. + */ + public static DesiredConfigurationDefenderForServers fromString(String name) { + return fromString(name, DesiredConfigurationDefenderForServers.class); + } + + /** + * Gets known DesiredConfigurationDefenderForServers values. + * + * @return known DesiredConfigurationDefenderForServers values. + */ + public static Collection values() { + return values(DesiredConfigurationDefenderForServers.class); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/GuestConfigurationInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/GuestConfigurationInformation.java new file mode 100644 index 000000000000..106061678086 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/GuestConfigurationInformation.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Azure Policy and Machine Configuration service information. + */ +@Immutable +public final class GuestConfigurationInformation implements JsonSerializable { + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of GuestConfigurationInformation class. + */ + private GuestConfigurationInformation() { + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GuestConfigurationInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestConfigurationInformation 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 GuestConfigurationInformation. + */ + public static GuestConfigurationInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestConfigurationInformation deserializedGuestConfigurationInformation + = new GuestConfigurationInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enablementStatus".equals(fieldName)) { + deserializedGuestConfigurationInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestConfigurationInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOp.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOp.java new file mode 100644 index 000000000000..4d87aa234dce --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOp.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner; + +/** + * An immutable client-side representation of ManagedOp. + */ +public interface ManagedOp { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ManagedOpsProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner object. + * + * @return the inner object. + */ + ManagedOpInner innerModel(); + + /** + * The entirety of the ManagedOp definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The ManagedOp definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ManagedOp definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the ManagedOp definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedOp create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedOp create(Context context); + } + + /** + * The stage of the ManagedOp 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(ManagedOpsProperties properties); + } + } + + /** + * Begins update for the ManagedOp resource. + * + * @return the stage of resource update. + */ + ManagedOp.Update update(); + + /** + * The template for ManagedOp update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedOp apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedOp apply(Context context); + } + + /** + * The ManagedOp update stages. + */ + interface UpdateStages { + /** + * The stage of the ManagedOp update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ManagedOpUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedOp refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedOp refresh(Context context); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdate.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdate.java new file mode 100644 index 000000000000..380150ee0d3e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdate.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The type used for update operations of the ManagedOp. + */ +@Fluent +public final class ManagedOpUpdate implements JsonSerializable { + /* + * The resource-specific properties for this resource. + */ + private ManagedOpUpdateProperties properties; + + /** + * Creates an instance of ManagedOpUpdate class. + */ + public ManagedOpUpdate() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ManagedOpUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ManagedOpUpdate object itself. + */ + public ManagedOpUpdate withProperties(ManagedOpUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOpUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOpUpdate 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 ManagedOpUpdate. + */ + public static ManagedOpUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOpUpdate deserializedManagedOpUpdate = new ManagedOpUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedManagedOpUpdate.properties = ManagedOpUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOpUpdate; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdateProperties.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdateProperties.java new file mode 100644 index 000000000000..4b1bba725c60 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdateProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The updatable properties of the ManagedOp. + */ +@Fluent +public final class ManagedOpUpdateProperties implements JsonSerializable { + /* + * Desired configuration input by the user. + */ + private DesiredConfiguration desiredConfiguration; + + /** + * Creates an instance of ManagedOpUpdateProperties class. + */ + public ManagedOpUpdateProperties() { + } + + /** + * Get the desiredConfiguration property: Desired configuration input by the user. + * + * @return the desiredConfiguration value. + */ + public DesiredConfiguration desiredConfiguration() { + return this.desiredConfiguration; + } + + /** + * Set the desiredConfiguration property: Desired configuration input by the user. + * + * @param desiredConfiguration the desiredConfiguration value to set. + * @return the ManagedOpUpdateProperties object itself. + */ + public ManagedOpUpdateProperties withDesiredConfiguration(DesiredConfiguration desiredConfiguration) { + this.desiredConfiguration = desiredConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("desiredConfiguration", this.desiredConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOpUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOpUpdateProperties 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 ManagedOpUpdateProperties. + */ + public static ManagedOpUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOpUpdateProperties deserializedManagedOpUpdateProperties = new ManagedOpUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("desiredConfiguration".equals(fieldName)) { + deserializedManagedOpUpdateProperties.desiredConfiguration = DesiredConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOpUpdateProperties; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOps.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOps.java new file mode 100644 index 000000000000..bf81ca0f8861 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOps.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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 ManagedOps. + */ +public interface ManagedOps { + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response}. + */ + Response getWithResponse(String managedOpsName, Context context); + + /** + * Gets the information of the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance. + */ + ManagedOp get(String managedOpsName); + + /** + * List all ManagedOps instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List all ManagedOps instances in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ManagedOp list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String managedOpsName); + + /** + * Deletes the ManagedOps instance. + * + * @param managedOpsName Name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String managedOpsName, Context context); + + /** + * Gets the information of the ManagedOps instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response}. + */ + ManagedOp getById(String id); + + /** + * Gets the information of the ManagedOps instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information of the ManagedOps instance along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the ManagedOps instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the ManagedOps instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedOp resource. + * + * @param name resource name. + * @return the first stage of the new ManagedOp definition. + */ + ManagedOp.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpsProperties.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpsProperties.java new file mode 100644 index 000000000000..69386b3c9a3d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpsProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of the ManagedOps resource. + */ +@Fluent +public final class ManagedOpsProperties implements JsonSerializable { + /* + * Product plan details of this resource. + */ + private Sku sku; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /* + * Desired configuration input by the user. + */ + private DesiredConfiguration desiredConfiguration; + + /* + * Services provisioned by this resource. + */ + private ServiceInformation services; + + /* + * Policy assignments created for managing services. + */ + private PolicyAssignmentProperties policyAssignmentProperties; + + /** + * Creates an instance of ManagedOpsProperties class. + */ + public ManagedOpsProperties() { + } + + /** + * Get the sku property: Product plan details of this resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the desiredConfiguration property: Desired configuration input by the user. + * + * @return the desiredConfiguration value. + */ + public DesiredConfiguration desiredConfiguration() { + return this.desiredConfiguration; + } + + /** + * Set the desiredConfiguration property: Desired configuration input by the user. + * + * @param desiredConfiguration the desiredConfiguration value to set. + * @return the ManagedOpsProperties object itself. + */ + public ManagedOpsProperties withDesiredConfiguration(DesiredConfiguration desiredConfiguration) { + this.desiredConfiguration = desiredConfiguration; + return this; + } + + /** + * Get the services property: Services provisioned by this resource. + * + * @return the services value. + */ + public ServiceInformation services() { + return this.services; + } + + /** + * Get the policyAssignmentProperties property: Policy assignments created for managing services. + * + * @return the policyAssignmentProperties value. + */ + public PolicyAssignmentProperties policyAssignmentProperties() { + return this.policyAssignmentProperties; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("desiredConfiguration", this.desiredConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOpsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOpsProperties 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 ManagedOpsProperties. + */ + public static ManagedOpsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOpsProperties deserializedManagedOpsProperties = new ManagedOpsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("desiredConfiguration".equals(fieldName)) { + deserializedManagedOpsProperties.desiredConfiguration = DesiredConfiguration.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedManagedOpsProperties.sku = Sku.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedManagedOpsProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("services".equals(fieldName)) { + deserializedManagedOpsProperties.services = ServiceInformation.fromJson(reader); + } else if ("policyAssignmentProperties".equals(fieldName)) { + deserializedManagedOpsProperties.policyAssignmentProperties + = PolicyAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOpsProperties; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Operation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Operation.java new file mode 100644 index 000000000000..0cc136f6fdbe --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.models; + +import com.azure.resourcemanager.managedops.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.managedops.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/OperationDisplay.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/OperationDisplay.java new file mode 100644 index 000000000000..51def8b23a69 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Operations.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Operations.java new file mode 100644 index 000000000000..b002dea31b68 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Origin.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Origin.java new file mode 100644 index 000000000000..5cd52482250a --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/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.managedops.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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/PolicyAssignmentProperties.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/PolicyAssignmentProperties.java new file mode 100644 index 000000000000..d67ab406f2d7 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/PolicyAssignmentProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Policy assignments created for managing services. + */ +@Immutable +public final class PolicyAssignmentProperties implements JsonSerializable { + /* + * Policy initiative assignment ID. + */ + private String policyInitiativeAssignmentId; + + /** + * Creates an instance of PolicyAssignmentProperties class. + */ + private PolicyAssignmentProperties() { + } + + /** + * Get the policyInitiativeAssignmentId property: Policy initiative assignment ID. + * + * @return the policyInitiativeAssignmentId value. + */ + public String policyInitiativeAssignmentId() { + return this.policyInitiativeAssignmentId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("policyInitiativeAssignmentId", this.policyInitiativeAssignmentId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PolicyAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PolicyAssignmentProperties 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 PolicyAssignmentProperties. + */ + public static PolicyAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PolicyAssignmentProperties deserializedPolicyAssignmentProperties = new PolicyAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policyInitiativeAssignmentId".equals(fieldName)) { + deserializedPolicyAssignmentProperties.policyInitiativeAssignmentId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPolicyAssignmentProperties; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ProvisioningState.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ProvisioningState.java new file mode 100644 index 000000000000..943251bdd3c5 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ProvisioningState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource. + */ +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"); + + /** + * The resource has begun provisioning. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is being deleted. + */ + 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/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ServiceInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ServiceInformation.java new file mode 100644 index 000000000000..95d89aeea111 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/ServiceInformation.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Services provisioned by this resource. + */ +@Immutable +public final class ServiceInformation implements JsonSerializable { + /* + * Change Tracking and Inventory service information. + */ + private ChangeTrackingInformation changeTrackingAndInventory; + + /* + * Azure Monitor Insights service information. + */ + private AzureMonitorInformation azureMonitorInsights; + + /* + * Azure Update Manager service information. + */ + private UpdateManagerInformation azureUpdateManager; + + /* + * Azure Policy and Machine Configuration service information. + */ + private GuestConfigurationInformation azurePolicyAndMachineConfiguration; + + /* + * Defender for Servers service information. + */ + private DefenderForServersInformation defenderForServers; + + /* + * Defender for Cloud's Cloud security posture management (CSPM) service information. + */ + private DefenderCspmInformation defenderCspm; + + /** + * Creates an instance of ServiceInformation class. + */ + private ServiceInformation() { + } + + /** + * Get the changeTrackingAndInventory property: Change Tracking and Inventory service information. + * + * @return the changeTrackingAndInventory value. + */ + public ChangeTrackingInformation changeTrackingAndInventory() { + return this.changeTrackingAndInventory; + } + + /** + * Get the azureMonitorInsights property: Azure Monitor Insights service information. + * + * @return the azureMonitorInsights value. + */ + public AzureMonitorInformation azureMonitorInsights() { + return this.azureMonitorInsights; + } + + /** + * Get the azureUpdateManager property: Azure Update Manager service information. + * + * @return the azureUpdateManager value. + */ + public UpdateManagerInformation azureUpdateManager() { + return this.azureUpdateManager; + } + + /** + * Get the azurePolicyAndMachineConfiguration property: Azure Policy and Machine Configuration service information. + * + * @return the azurePolicyAndMachineConfiguration value. + */ + public GuestConfigurationInformation azurePolicyAndMachineConfiguration() { + return this.azurePolicyAndMachineConfiguration; + } + + /** + * Get the defenderForServers property: Defender for Servers service information. + * + * @return the defenderForServers value. + */ + public DefenderForServersInformation defenderForServers() { + return this.defenderForServers; + } + + /** + * Get the defenderCspm property: Defender for Cloud's Cloud security posture management (CSPM) service information. + * + * @return the defenderCspm value. + */ + public DefenderCspmInformation defenderCspm() { + return this.defenderCspm; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceInformation 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 ServiceInformation. + */ + public static ServiceInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceInformation deserializedServiceInformation = new ServiceInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("changeTrackingAndInventory".equals(fieldName)) { + deserializedServiceInformation.changeTrackingAndInventory + = ChangeTrackingInformation.fromJson(reader); + } else if ("azureMonitorInsights".equals(fieldName)) { + deserializedServiceInformation.azureMonitorInsights = AzureMonitorInformation.fromJson(reader); + } else if ("azureUpdateManager".equals(fieldName)) { + deserializedServiceInformation.azureUpdateManager = UpdateManagerInformation.fromJson(reader); + } else if ("azurePolicyAndMachineConfiguration".equals(fieldName)) { + deserializedServiceInformation.azurePolicyAndMachineConfiguration + = GuestConfigurationInformation.fromJson(reader); + } else if ("defenderForServers".equals(fieldName)) { + deserializedServiceInformation.defenderForServers = DefenderForServersInformation.fromJson(reader); + } else if ("defenderCspm".equals(fieldName)) { + deserializedServiceInformation.defenderCspm = DefenderCspmInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Sku.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Sku.java new file mode 100644 index 000000000000..3453ddc4b5f4 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/Sku.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Specifies the service plan for this resource. + */ +@Immutable +public final class Sku implements JsonSerializable { + /* + * Name of the SKU. + */ + private String name; + + /* + * Pricing tier of the SKU. + */ + private String tier; + + /** + * Creates an instance of Sku class. + */ + private Sku() { + } + + /** + * Get the name property: Name of the SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the tier property: Pricing tier of the SKU. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("tier", this.tier); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sku 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 Sku. + */ + public static Sku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Sku deserializedSku = new Sku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSku.name = reader.getString(); + } else if ("tier".equals(fieldName)) { + deserializedSku.tier = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSku; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/UpdateManagerInformation.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/UpdateManagerInformation.java new file mode 100644 index 000000000000..fca4613629bf --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/UpdateManagerInformation.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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; + +/** + * Azure Update Manager service information. + */ +@Immutable +public final class UpdateManagerInformation implements JsonSerializable { + /* + * Indicates whether the service is enabled. + */ + private ChangeTrackingInformationEnablementStatus enablementStatus; + + /** + * Creates an instance of UpdateManagerInformation class. + */ + private UpdateManagerInformation() { + } + + /** + * Get the enablementStatus property: Indicates whether the service is enabled. + * + * @return the enablementStatus value. + */ + public ChangeTrackingInformationEnablementStatus enablementStatus() { + return this.enablementStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("enablementStatus", + this.enablementStatus == null ? null : this.enablementStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateManagerInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateManagerInformation 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 UpdateManagerInformation. + */ + public static UpdateManagerInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateManagerInformation deserializedUpdateManagerInformation = new UpdateManagerInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enablementStatus".equals(fieldName)) { + deserializedUpdateManagerInformation.enablementStatus + = ChangeTrackingInformationEnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateManagerInformation; + }); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/package-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/package-info.java new file mode 100644 index 000000000000..60bd636a2ded --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ManagedOpsManagementClient. + * Managed Operations API. + */ +package com.azure.resourcemanager.managedops.models; diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/package-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/package-info.java new file mode 100644 index 000000000000..a888251d96dc --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/com/azure/resourcemanager/managedops/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ManagedOpsManagementClient. + * Managed Operations API. + */ +package com.azure.resourcemanager.managedops; diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/java/module-info.java b/sdk/managedops/azure-resourcemanager-managedops/src/main/java/module-info.java new file mode 100644 index 000000000000..44b0215e5b2d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/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.managedops { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.managedops; + exports com.azure.resourcemanager.managedops.fluent; + exports com.azure.resourcemanager.managedops.fluent.models; + exports com.azure.resourcemanager.managedops.models; + + opens com.azure.resourcemanager.managedops.fluent.models to com.azure.core; + opens com.azure.resourcemanager.managedops.models to com.azure.core; + opens com.azure.resourcemanager.managedops.implementation.models to com.azure.core; +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_apiview_properties.json b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_apiview_properties.json new file mode 100644 index 000000000000..78862497712e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_apiview_properties.json @@ -0,0 +1,44 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient": "Microsoft.ManagedOps.ManagedOps", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginCreateOrUpdate": "Microsoft.ManagedOps.ManagedOps.createOrUpdate", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginDelete": "Microsoft.ManagedOps.ManagedOps.delete", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginUpdate": "Microsoft.ManagedOps.ManagedOps.update", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.createOrUpdate": "Microsoft.ManagedOps.ManagedOps.createOrUpdate", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.delete": "Microsoft.ManagedOps.ManagedOps.delete", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.get": "Microsoft.ManagedOps.ManagedOps.get", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.getWithResponse": "Microsoft.ManagedOps.ManagedOps.get", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.list": "Microsoft.ManagedOps.ManagedOps.list", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.update": "Microsoft.ManagedOps.ManagedOps.update", + "com.azure.resourcemanager.managedops.fluent.ManagedOpsManagementClient": "Microsoft.ManagedOps", + "com.azure.resourcemanager.managedops.fluent.OperationsClient": "Microsoft.ManagedOps.Operations", + "com.azure.resourcemanager.managedops.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner": "Microsoft.ManagedOps.ManagedOp", + "com.azure.resourcemanager.managedops.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "com.azure.resourcemanager.managedops.implementation.ManagedOpsManagementClientBuilder": "Microsoft.ManagedOps", + "com.azure.resourcemanager.managedops.implementation.models.ManagedOpListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.managedops.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "com.azure.resourcemanager.managedops.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration": "Microsoft.ManagedOps.AzureMonitorConfiguration", + "com.azure.resourcemanager.managedops.models.AzureMonitorInformation": "Microsoft.ManagedOps.AzureMonitorInformation", + "com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration": "Microsoft.ManagedOps.ChangeTrackingConfiguration", + "com.azure.resourcemanager.managedops.models.ChangeTrackingInformation": "Microsoft.ManagedOps.ChangeTrackingInformation", + "com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus": "Microsoft.ManagedOps.ChangeTrackingInformation.enablementStatus.anonymous", + "com.azure.resourcemanager.managedops.models.DefenderCspmInformation": "Microsoft.ManagedOps.DefenderCspmInformation", + "com.azure.resourcemanager.managedops.models.DefenderForServersInformation": "Microsoft.ManagedOps.DefenderForServersInformation", + "com.azure.resourcemanager.managedops.models.DesiredConfiguration": "Microsoft.ManagedOps.DesiredConfiguration", + "com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers": "Microsoft.ManagedOps.DesiredConfiguration.defenderForServers.anonymous", + "com.azure.resourcemanager.managedops.models.GuestConfigurationInformation": "Microsoft.ManagedOps.GuestConfigurationInformation", + "com.azure.resourcemanager.managedops.models.ManagedOpUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "com.azure.resourcemanager.managedops.models.ManagedOpUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "com.azure.resourcemanager.managedops.models.ManagedOpsProperties": "Microsoft.ManagedOps.ManagedOpsProperties", + "com.azure.resourcemanager.managedops.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "com.azure.resourcemanager.managedops.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "com.azure.resourcemanager.managedops.models.PolicyAssignmentProperties": "Microsoft.ManagedOps.PolicyAssignmentProperties", + "com.azure.resourcemanager.managedops.models.ProvisioningState": "Microsoft.ManagedOps.ProvisioningState", + "com.azure.resourcemanager.managedops.models.ServiceInformation": "Microsoft.ManagedOps.ServiceInformation", + "com.azure.resourcemanager.managedops.models.Sku": "Microsoft.ManagedOps.Sku", + "com.azure.resourcemanager.managedops.models.UpdateManagerInformation": "Microsoft.ManagedOps.UpdateManagerInformation" + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_metadata.json b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_metadata.json new file mode 100644 index 000000000000..103647600b65 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/azure-resourcemanager-managedops_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-07-28-preview","crossLanguageDefinitions":{"com.azure.resourcemanager.managedops.fluent.ManagedOpsClient":"Microsoft.ManagedOps.ManagedOps","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginCreateOrUpdate":"Microsoft.ManagedOps.ManagedOps.createOrUpdate","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginDelete":"Microsoft.ManagedOps.ManagedOps.delete","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.beginUpdate":"Microsoft.ManagedOps.ManagedOps.update","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.createOrUpdate":"Microsoft.ManagedOps.ManagedOps.createOrUpdate","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.delete":"Microsoft.ManagedOps.ManagedOps.delete","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.get":"Microsoft.ManagedOps.ManagedOps.get","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.getWithResponse":"Microsoft.ManagedOps.ManagedOps.get","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.list":"Microsoft.ManagedOps.ManagedOps.list","com.azure.resourcemanager.managedops.fluent.ManagedOpsClient.update":"Microsoft.ManagedOps.ManagedOps.update","com.azure.resourcemanager.managedops.fluent.ManagedOpsManagementClient":"Microsoft.ManagedOps","com.azure.resourcemanager.managedops.fluent.OperationsClient":"Microsoft.ManagedOps.Operations","com.azure.resourcemanager.managedops.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner":"Microsoft.ManagedOps.ManagedOp","com.azure.resourcemanager.managedops.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.managedops.implementation.ManagedOpsManagementClientBuilder":"Microsoft.ManagedOps","com.azure.resourcemanager.managedops.implementation.models.ManagedOpListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.managedops.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.managedops.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration":"Microsoft.ManagedOps.AzureMonitorConfiguration","com.azure.resourcemanager.managedops.models.AzureMonitorInformation":"Microsoft.ManagedOps.AzureMonitorInformation","com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration":"Microsoft.ManagedOps.ChangeTrackingConfiguration","com.azure.resourcemanager.managedops.models.ChangeTrackingInformation":"Microsoft.ManagedOps.ChangeTrackingInformation","com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus":"Microsoft.ManagedOps.ChangeTrackingInformation.enablementStatus.anonymous","com.azure.resourcemanager.managedops.models.DefenderCspmInformation":"Microsoft.ManagedOps.DefenderCspmInformation","com.azure.resourcemanager.managedops.models.DefenderForServersInformation":"Microsoft.ManagedOps.DefenderForServersInformation","com.azure.resourcemanager.managedops.models.DesiredConfiguration":"Microsoft.ManagedOps.DesiredConfiguration","com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers":"Microsoft.ManagedOps.DesiredConfiguration.defenderForServers.anonymous","com.azure.resourcemanager.managedops.models.GuestConfigurationInformation":"Microsoft.ManagedOps.GuestConfigurationInformation","com.azure.resourcemanager.managedops.models.ManagedOpUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","com.azure.resourcemanager.managedops.models.ManagedOpUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","com.azure.resourcemanager.managedops.models.ManagedOpsProperties":"Microsoft.ManagedOps.ManagedOpsProperties","com.azure.resourcemanager.managedops.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.managedops.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.managedops.models.PolicyAssignmentProperties":"Microsoft.ManagedOps.PolicyAssignmentProperties","com.azure.resourcemanager.managedops.models.ProvisioningState":"Microsoft.ManagedOps.ProvisioningState","com.azure.resourcemanager.managedops.models.ServiceInformation":"Microsoft.ManagedOps.ServiceInformation","com.azure.resourcemanager.managedops.models.Sku":"Microsoft.ManagedOps.Sku","com.azure.resourcemanager.managedops.models.UpdateManagerInformation":"Microsoft.ManagedOps.UpdateManagerInformation"},"generatedFiles":["src/main/java/com/azure/resourcemanager/managedops/ManagedOpsManager.java","src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsClient.java","src/main/java/com/azure/resourcemanager/managedops/fluent/ManagedOpsManagementClient.java","src/main/java/com/azure/resourcemanager/managedops/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/managedops/fluent/models/ManagedOpInner.java","src/main/java/com/azure/resourcemanager/managedops/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/managedops/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/managedops/fluent/package-info.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsClientImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ManagedOpsManagementClientImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/managedops/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/managedops/implementation/models/ManagedOpListResult.java","src/main/java/com/azure/resourcemanager/managedops/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/managedops/implementation/package-info.java","src/main/java/com/azure/resourcemanager/managedops/models/ActionType.java","src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorConfiguration.java","src/main/java/com/azure/resourcemanager/managedops/models/AzureMonitorInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingConfiguration.java","src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/ChangeTrackingInformationEnablementStatus.java","src/main/java/com/azure/resourcemanager/managedops/models/DefenderCspmInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/DefenderForServersInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfiguration.java","src/main/java/com/azure/resourcemanager/managedops/models/DesiredConfigurationDefenderForServers.java","src/main/java/com/azure/resourcemanager/managedops/models/GuestConfigurationInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/ManagedOp.java","src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdate.java","src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpUpdateProperties.java","src/main/java/com/azure/resourcemanager/managedops/models/ManagedOps.java","src/main/java/com/azure/resourcemanager/managedops/models/ManagedOpsProperties.java","src/main/java/com/azure/resourcemanager/managedops/models/Operation.java","src/main/java/com/azure/resourcemanager/managedops/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/managedops/models/Operations.java","src/main/java/com/azure/resourcemanager/managedops/models/Origin.java","src/main/java/com/azure/resourcemanager/managedops/models/PolicyAssignmentProperties.java","src/main/java/com/azure/resourcemanager/managedops/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/managedops/models/ServiceInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/Sku.java","src/main/java/com/azure/resourcemanager/managedops/models/UpdateManagerInformation.java","src/main/java/com/azure/resourcemanager/managedops/models/package-info.java","src/main/java/com/azure/resourcemanager/managedops/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/proxy-config.json b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/proxy-config.json new file mode 100644 index 000000000000..0a40239a9738 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.managedops.implementation.ManagedOpsClientImpl$ManagedOpsService"],["com.azure.resourcemanager.managedops.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/reflect-config.json b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-managedops/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/azure-resourcemanager-managedops.properties b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/azure-resourcemanager-managedops.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/main/resources/azure-resourcemanager-managedops.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..acd5d03a96ae --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateSamples.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.managedops.generated; + +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; + +/** + * Samples for ManagedOps CreateOrUpdate. + */ +public final class ManagedOpsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_CreateOrUpdate.json + */ + /** + * Sample code: ManagedOps_CreateOrUpdate. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsCreateOrUpdate(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps() + .define("default") + .withProperties(new ManagedOpsProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory(new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/00000000-0000-0000-0000-000000000000-Default")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/example")) + .withUserAssignedManagedIdentityId( + "/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myManagedIdentity"))) + .create(); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsDeleteSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsDeleteSamples.java new file mode 100644 index 000000000000..4bf111932a16 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +/** + * Samples for ManagedOps Delete. + */ +public final class ManagedOpsDeleteSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Delete.json + */ + /** + * Sample code: ManagedOps_Delete. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsDelete(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().delete("default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetSamples.java new file mode 100644 index 000000000000..83efeeaf945c --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +/** + * Samples for ManagedOps Get. + */ +public final class ManagedOpsGetSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Get.json + */ + /** + * Sample code: ManagedOps_Get. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsGet(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().getWithResponse("default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListSamples.java new file mode 100644 index 000000000000..31baf0e47323 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +/** + * Samples for ManagedOps List. + */ +public final class ManagedOpsListSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_List.json + */ + /** + * Sample code: ManagedOps_List. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsList(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.managedOps().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsUpdateSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsUpdateSamples.java new file mode 100644 index 000000000000..544e4987fa0d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/ManagedOpsUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.resourcemanager.managedops.models.ManagedOp; + +/** + * Samples for ManagedOps Update. + */ +public final class ManagedOpsUpdateSamples { + /* + * x-ms-original-file: 2025-07-28-preview/ManagedOps_Update.json + */ + /** + * Sample code: ManagedOps_Update. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void managedOpsUpdate(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + ManagedOp resource + = manager.managedOps().getWithResponse("default", com.azure.core.util.Context.NONE).getValue(); + resource.update().apply(); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/OperationsListSamples.java b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/OperationsListSamples.java new file mode 100644 index 000000000000..f28ed1c5774d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/samples/java/com/azure/resourcemanager/managedops/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-07-28-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to ManagedOpsManager. + */ + public static void operationsList(com.azure.resourcemanager.managedops.ManagedOpsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorConfigurationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorConfigurationTests.java new file mode 100644 index 000000000000..e6796fc65432 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorConfigurationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorConfiguration model = BinaryData.fromString("{\"azureMonitorWorkspaceId\":\"hqtrgqjbpf\"}") + .toObject(AzureMonitorConfiguration.class); + Assertions.assertEquals("hqtrgqjbpf", model.azureMonitorWorkspaceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMonitorConfiguration model = new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("hqtrgqjbpf"); + model = BinaryData.fromObject(model).toObject(AzureMonitorConfiguration.class); + Assertions.assertEquals("hqtrgqjbpf", model.azureMonitorWorkspaceId()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorInformationTests.java new file mode 100644 index 000000000000..110e85a241e0 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/AzureMonitorInformationTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorInformation; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorInformation model + = BinaryData.fromString("{\"dcrId\":\"jkjlxofpdvhpfx\",\"enablementStatus\":\"InProgress\"}") + .toObject(AzureMonitorInformation.class); + Assertions.assertEquals("jkjlxofpdvhpfx", model.dcrId()); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.IN_PROGRESS, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingConfigurationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingConfigurationTests.java new file mode 100644 index 000000000000..89924b481c7e --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingConfigurationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class ChangeTrackingConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeTrackingConfiguration model = BinaryData.fromString("{\"logAnalyticsWorkspaceId\":\"evdphlxaol\"}") + .toObject(ChangeTrackingConfiguration.class); + Assertions.assertEquals("evdphlxaol", model.logAnalyticsWorkspaceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChangeTrackingConfiguration model = new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("evdphlxaol"); + model = BinaryData.fromObject(model).toObject(ChangeTrackingConfiguration.class); + Assertions.assertEquals("evdphlxaol", model.logAnalyticsWorkspaceId()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingInformationTests.java new file mode 100644 index 000000000000..12e1369c3e37 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ChangeTrackingInformationTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformation; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import org.junit.jupiter.api.Assertions; + +public final class ChangeTrackingInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChangeTrackingInformation model + = BinaryData.fromString("{\"dcrId\":\"lluwfzitonpeq\",\"enablementStatus\":\"Failed\"}") + .toObject(ChangeTrackingInformation.class); + Assertions.assertEquals("lluwfzitonpeq", model.dcrId()); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.FAILED, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderCspmInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderCspmInformationTests.java new file mode 100644 index 000000000000..03d43df977ad --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderCspmInformationTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import com.azure.resourcemanager.managedops.models.DefenderCspmInformation; +import org.junit.jupiter.api.Assertions; + +public final class DefenderCspmInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DefenderCspmInformation model + = BinaryData.fromString("{\"enablementStatus\":\"Enabled\"}").toObject(DefenderCspmInformation.class); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.ENABLED, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderForServersInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderForServersInformationTests.java new file mode 100644 index 000000000000..2f8fe35875cd --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DefenderForServersInformationTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import com.azure.resourcemanager.managedops.models.DefenderForServersInformation; +import org.junit.jupiter.api.Assertions; + +public final class DefenderForServersInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DefenderForServersInformation model + = BinaryData.fromString("{\"enablementStatus\":\"Failed\"}").toObject(DefenderForServersInformation.class); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.FAILED, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DesiredConfigurationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DesiredConfigurationTests.java new file mode 100644 index 000000000000..dac2248080a7 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/DesiredConfigurationTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import org.junit.jupiter.api.Assertions; + +public final class DesiredConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DesiredConfiguration model = BinaryData.fromString( + "{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"cctazakljlahbc\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"yffdfdos\"},\"userAssignedManagedIdentityId\":\"gexpaojakhmsbz\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Enable\"}") + .toObject(DesiredConfiguration.class); + Assertions.assertEquals("cctazakljlahbc", model.changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("yffdfdos", model.azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("gexpaojakhmsbz", model.userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, model.defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, model.defenderCspm()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DesiredConfiguration model = new DesiredConfiguration() + .withChangeTrackingAndInventory( + new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("cctazakljlahbc")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("yffdfdos")) + .withUserAssignedManagedIdentityId("gexpaojakhmsbz") + .withDefenderForServers(DesiredConfigurationDefenderForServers.DISABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.ENABLE); + model = BinaryData.fromObject(model).toObject(DesiredConfiguration.class); + Assertions.assertEquals("cctazakljlahbc", model.changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("yffdfdos", model.azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("gexpaojakhmsbz", model.userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, model.defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, model.defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/GuestConfigurationInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/GuestConfigurationInformationTests.java new file mode 100644 index 000000000000..8b01503c6c65 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/GuestConfigurationInformationTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import com.azure.resourcemanager.managedops.models.GuestConfigurationInformation; +import org.junit.jupiter.api.Assertions; + +public final class GuestConfigurationInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GuestConfigurationInformation model = BinaryData.fromString("{\"enablementStatus\":\"InProgress\"}") + .toObject(GuestConfigurationInformation.class); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.IN_PROGRESS, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpInnerTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpInnerTests.java new file mode 100644 index 000000000000..7f71e5865df6 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpInnerTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.fluent.models.ManagedOpInner; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; +import org.junit.jupiter.api.Assertions; + +public final class ManagedOpInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOpInner model = BinaryData.fromString( + "{\"properties\":{\"sku\":{\"name\":\"jbpzvgnwzsymg\",\"tier\":\"zufcyzkohdbi\"},\"provisioningState\":\"Succeeded\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"ufhfcbjysa\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"ithxqhabifpi\"},\"userAssignedManagedIdentityId\":\"xwczbyscnp\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"qniwbybrkxvdumj\",\"enablementStatus\":\"Enabled\"},\"azureMonitorInsights\":{\"dcrId\":\"fwvuk\",\"enablementStatus\":\"InProgress\"},\"azureUpdateManager\":{\"enablementStatus\":\"Failed\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"InProgress\"},\"defenderForServers\":{\"enablementStatus\":\"Disabled\"},\"defenderCspm\":{\"enablementStatus\":\"Enabled\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"jcny\"}},\"id\":\"hkryhtn\",\"name\":\"pczwlo\",\"type\":\"jye\"}") + .toObject(ManagedOpInner.class); + Assertions.assertEquals("ufhfcbjysa", + model.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("ithxqhabifpi", + model.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("xwczbyscnp", + model.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderCspm()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedOpInner model = new ManagedOpInner() + .withProperties(new ManagedOpsProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory( + new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("ufhfcbjysa")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("ithxqhabifpi")) + .withUserAssignedManagedIdentityId("xwczbyscnp") + .withDefenderForServers(DesiredConfigurationDefenderForServers.DISABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.DISABLE))); + model = BinaryData.fromObject(model).toObject(ManagedOpInner.class); + Assertions.assertEquals("ufhfcbjysa", + model.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("ithxqhabifpi", + model.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("xwczbyscnp", + model.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpListResultTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpListResultTests.java new file mode 100644 index 000000000000..7f154b263916 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpListResultTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.implementation.models.ManagedOpListResult; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import org.junit.jupiter.api.Assertions; + +public final class ManagedOpListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOpListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"sku\":{\"name\":\"epoo\",\"tier\":\"inuvamiheogn\"},\"provisioningState\":\"Deleting\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"zxtheotusivyevcc\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"qi\"},\"userAssignedManagedIdentityId\":\"nhungbw\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"xgispemvtzfkufu\",\"enablementStatus\":\"Disabled\"},\"azureMonitorInsights\":{\"dcrId\":\"ofx\",\"enablementStatus\":\"Failed\"},\"azureUpdateManager\":{\"enablementStatus\":\"InProgress\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Disabled\"},\"defenderForServers\":{\"enablementStatus\":\"InProgress\"},\"defenderCspm\":{\"enablementStatus\":\"Failed\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"jbasvmsmjqulngs\"}},\"id\":\"nbybkzgcwrwcl\",\"name\":\"xwrljdouskcqvkoc\",\"type\":\"cjdkwtnhxbnjbi\"},{\"properties\":{\"sku\":{\"name\":\"rglssainqpj\",\"tier\":\"nzl\"},\"provisioningState\":\"Provisioning\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"mppeebvmgxs\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"bkyqduu\"},\"userAssignedManagedIdentityId\":\"itcjczdz\",\"defenderForServers\":\"Enable\",\"defenderCspm\":\"Enable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"wpdappdsbdkv\",\"enablementStatus\":\"InProgress\"},\"azureMonitorInsights\":{\"dcrId\":\"jfeusnh\",\"enablementStatus\":\"InProgress\"},\"azureUpdateManager\":{\"enablementStatus\":\"Disabled\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Disabled\"},\"defenderForServers\":{\"enablementStatus\":\"Enabled\"},\"defenderCspm\":{\"enablementStatus\":\"Disabled\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"ugjzzdatqxhocdge\"}},\"id\":\"lgphu\",\"name\":\"icndvkaozwyifty\",\"type\":\"xhurok\"}],\"nextLink\":\"yxolniwp\"}") + .toObject(ManagedOpListResult.class); + Assertions.assertEquals("zxtheotusivyevcc", + model.value() + .get(0) + .properties() + .desiredConfiguration() + .changeTrackingAndInventory() + .logAnalyticsWorkspaceId()); + Assertions.assertEquals("qi", + model.value().get(0).properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("nhungbw", + model.value().get(0).properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.value().get(0).properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.value().get(0).properties().desiredConfiguration().defenderCspm()); + Assertions.assertEquals("yxolniwp", model.nextLink()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdatePropertiesTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdatePropertiesTests.java new file mode 100644 index 000000000000..dd9570e3821d --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdatePropertiesTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class ManagedOpUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOpUpdateProperties model = BinaryData.fromString( + "{\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"hsgcbacphejkot\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"nqgoulzndli\"},\"userAssignedManagedIdentityId\":\"wyqkgfgibm\",\"defenderForServers\":\"Enable\",\"defenderCspm\":\"Disable\"}}") + .toObject(ManagedOpUpdateProperties.class); + Assertions.assertEquals("hsgcbacphejkot", + model.desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("nqgoulzndli", + model.desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("wyqkgfgibm", model.desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, + model.desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderCspm()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedOpUpdateProperties model + = new ManagedOpUpdateProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory( + new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("hsgcbacphejkot")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("nqgoulzndli")) + .withUserAssignedManagedIdentityId("wyqkgfgibm") + .withDefenderForServers(DesiredConfigurationDefenderForServers.ENABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.DISABLE)); + model = BinaryData.fromObject(model).toObject(ManagedOpUpdateProperties.class); + Assertions.assertEquals("hsgcbacphejkot", + model.desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("nqgoulzndli", + model.desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("wyqkgfgibm", model.desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, + model.desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdateTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdateTests.java new file mode 100644 index 000000000000..0be85362b7d2 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpUpdateTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdate; +import com.azure.resourcemanager.managedops.models.ManagedOpUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class ManagedOpUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOpUpdate model = BinaryData.fromString( + "{\"properties\":{\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"kjfkg\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"awxklr\"},\"userAssignedManagedIdentityId\":\"plwckbas\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Disable\"}}}") + .toObject(ManagedOpUpdate.class); + Assertions.assertEquals("kjfkg", + model.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("awxklr", + model.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("plwckbas", model.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderCspm()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedOpUpdate model = new ManagedOpUpdate() + .withProperties(new ManagedOpUpdateProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory(new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("kjfkg")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("awxklr")) + .withUserAssignedManagedIdentityId("plwckbas") + .withDefenderForServers(DesiredConfigurationDefenderForServers.DISABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.DISABLE))); + model = BinaryData.fromObject(model).toObject(ManagedOpUpdate.class); + Assertions.assertEquals("kjfkg", + model.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("awxklr", + model.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("plwckbas", model.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.properties().desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateMockTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..2a758a777fbc --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsCreateOrUpdateMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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.managedops.ManagedOpsManager; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOp; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ManagedOpsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"sku\":{\"name\":\"e\",\"tier\":\"zloc\"},\"provisioningState\":\"Succeeded\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"paierh\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"bcsglumma\"},\"userAssignedManagedIdentityId\":\"tjaodxobnb\",\"defenderForServers\":\"Enable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"kajionpim\",\"enablementStatus\":\"Enabled\"},\"azureMonitorInsights\":{\"dcrId\":\"stxgc\",\"enablementStatus\":\"Disabled\"},\"azureUpdateManager\":{\"enablementStatus\":\"InProgress\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"InProgress\"},\"defenderForServers\":{\"enablementStatus\":\"Failed\"},\"defenderCspm\":{\"enablementStatus\":\"Failed\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"djwzrlov\"}},\"id\":\"lwhijcoejctbzaq\",\"name\":\"qsycbkbfkgu\",\"type\":\"dkexxppofm\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ManagedOpsManager manager = ManagedOpsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ManagedOp response = manager.managedOps() + .define("npvswjdkirso") + .withProperties(new ManagedOpsProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory(new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("h")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("soifiyipjxsqw")) + .withUserAssignedManagedIdentityId("gr") + .withDefenderForServers(DesiredConfigurationDefenderForServers.ENABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.DISABLE))) + .create(); + + Assertions.assertEquals("paierh", + response.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("bcsglumma", + response.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("tjaodxobnb", + response.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, + response.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + response.properties().desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetWithResponseMockTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetWithResponseMockTests.java new file mode 100644 index 000000000000..c91596418896 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsGetWithResponseMockTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.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.managedops.ManagedOpsManager; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOp; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ManagedOpsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"sku\":{\"name\":\"bmbexppbhtqqro\",\"tier\":\"fpfpsalgbquxigj\"},\"provisioningState\":\"Succeeded\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"zjaoyfhrtxil\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"erkujys\"},\"userAssignedManagedIdentityId\":\"l\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"wrlyxwjkcprb\",\"enablementStatus\":\"InProgress\"},\"azureMonitorInsights\":{\"dcrId\":\"xgjvtbv\",\"enablementStatus\":\"Disabled\"},\"azureUpdateManager\":{\"enablementStatus\":\"InProgress\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Disabled\"},\"defenderForServers\":{\"enablementStatus\":\"InProgress\"},\"defenderCspm\":{\"enablementStatus\":\"Enabled\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"guhmuouqfpr\"}},\"id\":\"wbnguitnwui\",\"name\":\"gazxuf\",\"type\":\"zuckyfi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ManagedOpsManager manager = ManagedOpsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ManagedOp response + = manager.managedOps().getWithResponse("svqwhbmdgbbjfd", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("zjaoyfhrtxil", + response.properties().desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("erkujys", + response.properties().desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("l", response.properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + response.properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + response.properties().desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListMockTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListMockTests.java new file mode 100644 index 000000000000..2cb4eea567a0 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsListMockTests.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.managedops.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.managedops.ManagedOpsManager; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOp; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ManagedOpsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"sku\":{\"name\":\"idf\",\"tier\":\"zwdzuh\"},\"provisioningState\":\"Failed\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"wisdkft\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"wxmnteiwao\"},\"userAssignedManagedIdentityId\":\"vkmijcmmxdcuf\",\"defenderForServers\":\"Enable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"zidnsezcxtbzsgfy\",\"enablementStatus\":\"Enabled\"},\"azureMonitorInsights\":{\"dcrId\":\"newmdwzjeiachbo\",\"enablementStatus\":\"Failed\"},\"azureUpdateManager\":{\"enablementStatus\":\"InProgress\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Enabled\"},\"defenderForServers\":{\"enablementStatus\":\"Failed\"},\"defenderCspm\":{\"enablementStatus\":\"InProgress\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"t\"}},\"id\":\"hzzvypyq\",\"name\":\"i\",\"type\":\"z\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ManagedOpsManager manager = ManagedOpsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.managedOps().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wisdkft", + response.iterator() + .next() + .properties() + .desiredConfiguration() + .changeTrackingAndInventory() + .logAnalyticsWorkspaceId()); + Assertions.assertEquals("wxmnteiwao", + response.iterator() + .next() + .properties() + .desiredConfiguration() + .azureMonitorInsights() + .azureMonitorWorkspaceId()); + Assertions.assertEquals("vkmijcmmxdcuf", + response.iterator().next().properties().desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.ENABLE, + response.iterator().next().properties().desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + response.iterator().next().properties().desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsPropertiesTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsPropertiesTests.java new file mode 100644 index 000000000000..d9aca257c807 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ManagedOpsPropertiesTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.AzureMonitorConfiguration; +import com.azure.resourcemanager.managedops.models.ChangeTrackingConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfiguration; +import com.azure.resourcemanager.managedops.models.DesiredConfigurationDefenderForServers; +import com.azure.resourcemanager.managedops.models.ManagedOpsProperties; +import org.junit.jupiter.api.Assertions; + +public final class ManagedOpsPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOpsProperties model = BinaryData.fromString( + "{\"sku\":{\"name\":\"kvnipjoxz\",\"tier\":\"nchgej\"},\"provisioningState\":\"Deleting\",\"desiredConfiguration\":{\"changeTrackingAndInventory\":{\"logAnalyticsWorkspaceId\":\"dmailzydehojw\"},\"azureMonitorInsights\":{\"azureMonitorWorkspaceId\":\"ahuxinpm\"},\"userAssignedManagedIdentityId\":\"njaqwixjspro\",\"defenderForServers\":\"Disable\",\"defenderCspm\":\"Disable\"},\"services\":{\"changeTrackingAndInventory\":{\"dcrId\":\"gjvw\",\"enablementStatus\":\"InProgress\"},\"azureMonitorInsights\":{\"dcrId\":\"atscmd\",\"enablementStatus\":\"Failed\"},\"azureUpdateManager\":{\"enablementStatus\":\"Disabled\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Disabled\"},\"defenderForServers\":{\"enablementStatus\":\"Disabled\"},\"defenderCspm\":{\"enablementStatus\":\"Disabled\"}},\"policyAssignmentProperties\":{\"policyInitiativeAssignmentId\":\"kjozkrwfnd\"}}") + .toObject(ManagedOpsProperties.class); + Assertions.assertEquals("dmailzydehojw", + model.desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("ahuxinpm", + model.desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("njaqwixjspro", model.desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderCspm()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedOpsProperties model = new ManagedOpsProperties().withDesiredConfiguration(new DesiredConfiguration() + .withChangeTrackingAndInventory( + new ChangeTrackingConfiguration().withLogAnalyticsWorkspaceId("dmailzydehojw")) + .withAzureMonitorInsights(new AzureMonitorConfiguration().withAzureMonitorWorkspaceId("ahuxinpm")) + .withUserAssignedManagedIdentityId("njaqwixjspro") + .withDefenderForServers(DesiredConfigurationDefenderForServers.DISABLE) + .withDefenderCspm(DesiredConfigurationDefenderForServers.DISABLE)); + model = BinaryData.fromObject(model).toObject(ManagedOpsProperties.class); + Assertions.assertEquals("dmailzydehojw", + model.desiredConfiguration().changeTrackingAndInventory().logAnalyticsWorkspaceId()); + Assertions.assertEquals("ahuxinpm", + model.desiredConfiguration().azureMonitorInsights().azureMonitorWorkspaceId()); + Assertions.assertEquals("njaqwixjspro", model.desiredConfiguration().userAssignedManagedIdentityId()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderForServers()); + Assertions.assertEquals(DesiredConfigurationDefenderForServers.DISABLE, + model.desiredConfiguration().defenderCspm()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationDisplayTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..2951802a395c --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.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/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationInnerTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationInnerTests.java new file mode 100644 index 000000000000..11f377e268b4 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.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/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationListResultTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationListResultTests.java new file mode 100644 index 000000000000..8d5970bfdb1f --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.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/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationsListMockTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..c5a48aecf0c9 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/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.managedops.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.managedops.ManagedOpsManager; +import com.azure.resourcemanager.managedops.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\":\"qsrxybzqqed\",\"isDataAction\":true,\"display\":{\"provider\":\"iqfouflmmnkz\",\"resource\":\"odmgl\",\"operation\":\"gpbkwtmut\",\"description\":\"qktapspwgcuert\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ManagedOpsManager manager = ManagedOpsManager.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/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/PolicyAssignmentPropertiesTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/PolicyAssignmentPropertiesTests.java new file mode 100644 index 000000000000..1b8c9eaa77d2 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/PolicyAssignmentPropertiesTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.PolicyAssignmentProperties; +import org.junit.jupiter.api.Assertions; + +public final class PolicyAssignmentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PolicyAssignmentProperties model = BinaryData.fromString("{\"policyInitiativeAssignmentId\":\"nmayhuybb\"}") + .toObject(PolicyAssignmentProperties.class); + Assertions.assertEquals("nmayhuybb", model.policyInitiativeAssignmentId()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ServiceInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ServiceInformationTests.java new file mode 100644 index 000000000000..fa4dc877e415 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/ServiceInformationTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ServiceInformation; + +public final class ServiceInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceInformation model = BinaryData.fromString( + "{\"changeTrackingAndInventory\":{\"dcrId\":\"s\",\"enablementStatus\":\"Enabled\"},\"azureMonitorInsights\":{\"dcrId\":\"gvfcj\",\"enablementStatus\":\"Enabled\"},\"azureUpdateManager\":{\"enablementStatus\":\"Failed\"},\"azurePolicyAndMachineConfiguration\":{\"enablementStatus\":\"Disabled\"},\"defenderForServers\":{\"enablementStatus\":\"InProgress\"},\"defenderCspm\":{\"enablementStatus\":\"Failed\"}}") + .toObject(ServiceInformation.class); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/SkuTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/SkuTests.java new file mode 100644 index 000000000000..f4764534a2a4 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/SkuTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.Sku; +import org.junit.jupiter.api.Assertions; + +public final class SkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Sku model = BinaryData.fromString("{\"name\":\"odjpslwejd\",\"tier\":\"vwryoqpso\"}").toObject(Sku.class); + Assertions.assertEquals("odjpslwejd", model.name()); + Assertions.assertEquals("vwryoqpso", model.tier()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/UpdateManagerInformationTests.java b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/UpdateManagerInformationTests.java new file mode 100644 index 000000000000..be60f12caeee --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/src/test/java/com/azure/resourcemanager/managedops/generated/UpdateManagerInformationTests.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.managedops.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.managedops.models.ChangeTrackingInformationEnablementStatus; +import com.azure.resourcemanager.managedops.models.UpdateManagerInformation; +import org.junit.jupiter.api.Assertions; + +public final class UpdateManagerInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UpdateManagerInformation model + = BinaryData.fromString("{\"enablementStatus\":\"Enabled\"}").toObject(UpdateManagerInformation.class); + Assertions.assertEquals(ChangeTrackingInformationEnablementStatus.ENABLED, model.enablementStatus()); + } +} diff --git a/sdk/managedops/azure-resourcemanager-managedops/tsp-location.yaml b/sdk/managedops/azure-resourcemanager-managedops/tsp-location.yaml new file mode 100644 index 000000000000..e8319a203a06 --- /dev/null +++ b/sdk/managedops/azure-resourcemanager-managedops/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/managedoperations/ManagedOps.Management +commit: 83408dfe4894a9b5a5d3989023647bce792efc5f +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/managedops/ci.yml b/sdk/managedops/ci.yml new file mode 100644 index 000000000000..fbccacca0d42 --- /dev/null +++ b/sdk/managedops/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/managedops/ci.yml + - sdk/managedops/azure-resourcemanager-managedops/ + exclude: + - sdk/managedops/pom.xml + - sdk/managedops/azure-resourcemanager-managedops/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedops/ci.yml + - sdk/managedops/azure-resourcemanager-managedops/ + exclude: + - sdk/managedops/pom.xml + - sdk/managedops/azure-resourcemanager-managedops/pom.xml + +parameters: + - name: release_azureresourcemanagermanagedops + displayName: azure-resourcemanager-managedops + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedops + Artifacts: + - name: azure-resourcemanager-managedops + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagedops + releaseInBatch: ${{ parameters.release_azureresourcemanagermanagedops }} diff --git a/sdk/managedops/pom.xml b/sdk/managedops/pom.xml new file mode 100644 index 000000000000..59a5f3cca625 --- /dev/null +++ b/sdk/managedops/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-managedops-service + pom + 1.0.0 + + + azure-resourcemanager-managedops + +