diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 56859a1315f88..4815b50bfc94f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index f511c48002b32..ca7b960605b2f 100644 --- a/pom.xml +++ b/pom.xml @@ -593,8 +593,8 @@ sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/deviceupdate sdk/digitaltwins sdk/eventgrid sdk/eventhubs @@ -607,6 +607,7 @@ sdk/keyvault sdk/kusto sdk/loganalytics + sdk/logz sdk/mediaservices sdk/metricsadvisor sdk/mixedreality diff --git a/sdk/logz/azure-resourcemanager-logz/CHANGELOG.md b/sdk/logz/azure-resourcemanager-logz/CHANGELOG.md new file mode 100644 index 0000000000000..3be655d3892eb --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-15) + +- Azure Resource Manager Logz client library for Java. This package contains Microsoft Azure SDK for Logz Management SDK. Package tag package-2020-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/logz/azure-resourcemanager-logz/README.md b/sdk/logz/azure-resourcemanager-logz/README.md new file mode 100644 index 0000000000000..1474cd407f378 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Logz client library for Java + +Azure Resource Manager Logz client library for Java. + +This package contains Microsoft Azure SDK for Logz Management SDK. Package tag package-2020-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-logz;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-logz + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +LogzManager manager = LogzManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/logz/azure-resourcemanager-logz/pom.xml b/sdk/logz/azure-resourcemanager-logz/pom.xml new file mode 100644 index 0000000000000..ebc5442a5cea9 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-logz + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Logz Management + This package contains Microsoft Azure SDK for Logz Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-10-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/LogzManager.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/LogzManager.java new file mode 100644 index 0000000000000..ac462bf2b3953 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/LogzManager.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz; + +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.policy.AddDatePolicy; +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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.MicrosoftLogz; +import com.azure.resourcemanager.logz.implementation.MicrosoftLogzBuilder; +import com.azure.resourcemanager.logz.implementation.MonitorsImpl; +import com.azure.resourcemanager.logz.implementation.OperationsImpl; +import com.azure.resourcemanager.logz.implementation.SingleSignOnsImpl; +import com.azure.resourcemanager.logz.implementation.SubAccountTagRulesImpl; +import com.azure.resourcemanager.logz.implementation.SubAccountsImpl; +import com.azure.resourcemanager.logz.implementation.TagRulesImpl; +import com.azure.resourcemanager.logz.models.Monitors; +import com.azure.resourcemanager.logz.models.Operations; +import com.azure.resourcemanager.logz.models.SingleSignOns; +import com.azure.resourcemanager.logz.models.SubAccountTagRules; +import com.azure.resourcemanager.logz.models.SubAccounts; +import com.azure.resourcemanager.logz.models.TagRules; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to LogzManager. */ +public final class LogzManager { + private Monitors monitors; + + private Operations operations; + + private TagRules tagRules; + + private SingleSignOns singleSignOns; + + private SubAccounts subAccounts; + + private SubAccountTagRules subAccountTagRules; + + private final MicrosoftLogz clientObject; + + private LogzManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftLogzBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Logz service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Logz service API instance. + */ + public static LogzManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create LogzManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new LogzManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + 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; + } + + /** + * 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Logz service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Logz service API instance. + */ + public LogzManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.logz") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new LogzManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Monitors. */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(clientObject.getMonitors(), this); + } + return monitors; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of TagRules. */ + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + } + return tagRules; + } + + /** @return Resource collection API of SingleSignOns. */ + public SingleSignOns singleSignOns() { + if (this.singleSignOns == null) { + this.singleSignOns = new SingleSignOnsImpl(clientObject.getSingleSignOns(), this); + } + return singleSignOns; + } + + /** @return Resource collection API of SubAccounts. */ + public SubAccounts subAccounts() { + if (this.subAccounts == null) { + this.subAccounts = new SubAccountsImpl(clientObject.getSubAccounts(), this); + } + return subAccounts; + } + + /** @return Resource collection API of SubAccountTagRules. */ + public SubAccountTagRules subAccountTagRules() { + if (this.subAccountTagRules == null) { + this.subAccountTagRules = new SubAccountTagRulesImpl(clientObject.getSubAccountTagRules(), this); + } + return subAccountTagRules; + } + + /** + * @return Wrapped service client MicrosoftLogz providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MicrosoftLogz serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MicrosoftLogz.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MicrosoftLogz.java new file mode 100644 index 0000000000000..eb545d97ceaf3 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MicrosoftLogz.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftLogz class. */ +public interface MicrosoftLogz { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + MonitorsClient getMonitors(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + TagRulesClient getTagRules(); + + /** + * Gets the SingleSignOnsClient object to access its operations. + * + * @return the SingleSignOnsClient object. + */ + SingleSignOnsClient getSingleSignOns(); + + /** + * Gets the SubAccountsClient object to access its operations. + * + * @return the SubAccountsClient object. + */ + SubAccountsClient getSubAccounts(); + + /** + * Gets the SubAccountTagRulesClient object to access its operations. + * + * @return the SubAccountTagRulesClient object. + */ + SubAccountTagRulesClient getSubAccountTagRules(); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MonitorsClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MonitorsClient.java new file mode 100644 index 0000000000000..dc937ddbaf8ee --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/MonitorsClient.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public interface MonitorsClient { + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create(String resourceGroupName, String monitorName, LogzMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create(String resourceGroupName, String monitorName); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner update(String resourceGroupName, String monitorName); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, LogzMonitorResourceUpdateParameters body, Context context); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, Context context); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/OperationsClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/OperationsClient.java new file mode 100644 index 0000000000000..f615554574b66 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.models.OperationResultInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List all operations provided by Microsoft.Logz. + * + * @throws com.azure.core.management.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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all operations provided by Microsoft.Logz. + * + * @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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SingleSignOnsClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SingleSignOnsClient.java new file mode 100644 index 0000000000000..931ee7eb71d24 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SingleSignOnsClient.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.models.LogzSingleSignOnResourceInner; + +/** An instance of this class provides access to all the operations defined in SingleSignOnsClient. */ +public interface SingleSignOnsClient { + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzSingleSignOnResourceInner get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @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 Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountTagRulesClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountTagRulesClient.java new file mode 100644 index 0000000000000..01d7d00b1eace --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountTagRulesClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.util.Context; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; + +/** An instance of this class provides access to all the operations defined in SubAccountTagRulesClient. */ +public interface SubAccountTagRulesClient { + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, String subAccountName); + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoringTagRulesInner createOrUpdate( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoringTagRulesInner get( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountsClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountsClient.java new file mode 100644 index 0000000000000..8fd7a298f4af2 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/SubAccountsClient.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; + +/** An instance of this class provides access to all the operations defined in SubAccountsClient. */ +public interface SubAccountsClient { + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner create( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context); + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner get(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogzMonitorResourceInner update(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceUpdateParameters body, + Context context); + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName); + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/TagRulesClient.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/TagRulesClient.java new file mode 100644 index 0000000000000..b1257a5203fdc --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/TagRulesClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.util.Context; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; + +/** An instance of this class provides access to all the operations defined in TagRulesClient. */ +public interface TagRulesClient { + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzMonitorResourceInner.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzMonitorResourceInner.java new file mode 100644 index 0000000000000..7cdd363b3c579 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzMonitorResourceInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.models.IdentityProperties; +import com.azure.resourcemanager.logz.models.MonitorProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The LogzMonitorResource model. */ +@Fluent +public final class LogzMonitorResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzMonitorResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Properties specific to the monitor resource. + */ + @JsonProperty(value = "properties") + private MonitorProperties properties; + + /* + * The identity property. + */ + @JsonProperty(value = "identity") + private IdentityProperties identity; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: Properties specific to the monitor resource. + * + * @return the properties value. + */ + public MonitorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties specific to the monitor resource. + * + * @param properties the properties value to set. + * @return the LogzMonitorResourceInner object itself. + */ + public LogzMonitorResourceInner withProperties(MonitorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The identity property. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: The identity property. + * + * @param identity the identity value to set. + * @return the LogzMonitorResourceInner object itself. + */ + public LogzMonitorResourceInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public LogzMonitorResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LogzMonitorResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzSingleSignOnResourceInner.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzSingleSignOnResourceInner.java new file mode 100644 index 0000000000000..3678c9ac9b1ab --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/LogzSingleSignOnResourceInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.models.LogzSingleSignOnProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LogzSingleSignOnResource model. */ +@Fluent +public final class LogzSingleSignOnResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzSingleSignOnResourceInner.class); + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private LogzSingleSignOnProperties properties; + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public LogzSingleSignOnProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the LogzSingleSignOnResourceInner object itself. + */ + public LogzSingleSignOnResourceInner withProperties(LogzSingleSignOnProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoredResourceInner.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoredResourceInner.java new file mode 100644 index 0000000000000..a9200028a0b08 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoredResourceInner.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a resource currently being monitored by the Logz monitor resource. */ +@Fluent +public final class MonitoredResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoredResourceInner.class); + + /* + * The ARM id of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Flag indicating if resource is sending metrics to Logz. + */ + @JsonProperty(value = "sendingMetrics") + private Boolean sendingMetrics; + + /* + * Reason for why the resource is sending metrics (or why it is not + * sending). + */ + @JsonProperty(value = "reasonForMetricsStatus") + private String reasonForMetricsStatus; + + /* + * Flag indicating if resource is sending logs to Logz. + */ + @JsonProperty(value = "sendingLogs") + private Boolean sendingLogs; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Reason for why the resource is sending logs (or why it is not sending). + */ + @JsonProperty(value = "reasonForLogsStatus") + private String reasonForLogsStatus; + + /** + * Get the id property: The ARM id of the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM id of the resource. + * + * @param id the id value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the sendingMetrics property: Flag indicating if resource is sending metrics to Logz. + * + * @return the sendingMetrics value. + */ + public Boolean sendingMetrics() { + return this.sendingMetrics; + } + + /** + * Set the sendingMetrics property: Flag indicating if resource is sending metrics to Logz. + * + * @param sendingMetrics the sendingMetrics value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingMetrics(Boolean sendingMetrics) { + this.sendingMetrics = sendingMetrics; + return this; + } + + /** + * Get the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + public String reasonForMetricsStatus() { + return this.reasonForMetricsStatus; + } + + /** + * Set the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @param reasonForMetricsStatus the reasonForMetricsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForMetricsStatus(String reasonForMetricsStatus) { + this.reasonForMetricsStatus = reasonForMetricsStatus; + return this; + } + + /** + * Get the sendingLogs property: Flag indicating if resource is sending logs to Logz. + * + * @return the sendingLogs value. + */ + public Boolean sendingLogs() { + return this.sendingLogs; + } + + /** + * Set the sendingLogs property: Flag indicating if resource is sending logs to Logz. + * + * @param sendingLogs the sendingLogs value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingLogs(Boolean sendingLogs) { + this.sendingLogs = sendingLogs; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + public String reasonForLogsStatus() { + return this.reasonForLogsStatus; + } + + /** + * Set the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @param reasonForLogsStatus the reasonForLogsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForLogsStatus(String reasonForLogsStatus) { + this.reasonForLogsStatus = reasonForLogsStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoringTagRulesInner.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoringTagRulesInner.java new file mode 100644 index 0000000000000..ccf6b7bcbca13 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/MonitoringTagRulesInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.models.MonitoringTagRulesProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Capture logs and metrics of Azure resources based on ARM tags. */ +@Fluent +public final class MonitoringTagRulesInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoringTagRulesInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Definition of the properties for a TagRules resource. + */ + @JsonProperty(value = "properties") + private MonitoringTagRulesProperties properties; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: Definition of the properties for a TagRules resource. + * + * @return the properties value. + */ + public MonitoringTagRulesProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Definition of the properties for a TagRules resource. + * + * @param properties the properties value to set. + * @return the MonitoringTagRulesInner object itself. + */ + public MonitoringTagRulesInner withProperties(MonitoringTagRulesProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/OperationResultInner.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/OperationResultInner.java new file mode 100644 index 0000000000000..8d5b586dc3e36 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/OperationResultInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A Microsoft.Logz REST API operation. */ +@Fluent +public final class OperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultInner.class); + + /* + * Operation name, i.e., {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Get the name property: Operation name, i.e., {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, i.e., {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/package-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/package-info.java new file mode 100644 index 0000000000000..b224bb213068e --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MicrosoftLogz. null. */ +package com.azure.resourcemanager.logz.fluent.models; diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/package-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/package-info.java new file mode 100644 index 0000000000000..00f933cdfd71f --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MicrosoftLogz. null. */ +package com.azure.resourcemanager.logz.fluent; diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzMonitorResourceImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzMonitorResourceImpl.java new file mode 100644 index 0000000000000..517dcad099caa --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzMonitorResourceImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.models.IdentityProperties; +import com.azure.resourcemanager.logz.models.LogzMonitorResource; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; +import com.azure.resourcemanager.logz.models.MonitorProperties; +import com.azure.resourcemanager.logz.models.MonitorUpdateProperties; +import com.azure.resourcemanager.logz.models.MonitoredResource; +import java.util.Collections; +import java.util.Map; + +public final class LogzMonitorResourceImpl + implements LogzMonitorResource, LogzMonitorResource.Definition, LogzMonitorResource.Update { + private LogzMonitorResourceInner innerObject; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public MonitorProperties properties() { + return this.innerModel().properties(); + } + + public IdentityProperties identity() { + return this.innerModel().identity(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LogzMonitorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private LogzMonitorResourceUpdateParameters updateBody; + + public LogzMonitorResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public LogzMonitorResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public LogzMonitorResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + LogzMonitorResourceImpl(String name, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = new LogzMonitorResourceInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public LogzMonitorResourceImpl update() { + this.updateBody = new LogzMonitorResourceUpdateParameters(); + return this; + } + + public LogzMonitorResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public LogzMonitorResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, context) + .getValue(); + return this; + } + + LogzMonitorResourceImpl( + LogzMonitorResourceInner innerObject, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public LogzMonitorResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public LogzMonitorResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public PagedIterable listMonitoredResources() { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName); + } + + public PagedIterable listMonitoredResources(Context context) { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName, context); + } + + public LogzMonitorResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LogzMonitorResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LogzMonitorResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public LogzMonitorResourceImpl withProperties(MonitorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public LogzMonitorResourceImpl withIdentity(IdentityProperties identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public LogzMonitorResourceImpl withProperties(MonitorUpdateProperties properties) { + this.updateBody.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzSingleSignOnResourceImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzSingleSignOnResourceImpl.java new file mode 100644 index 0000000000000..368a73f59a3b0 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/LogzSingleSignOnResourceImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner; +import com.azure.resourcemanager.logz.models.LogzSingleSignOnProperties; +import com.azure.resourcemanager.logz.models.LogzSingleSignOnResource; + +public final class LogzSingleSignOnResourceImpl + implements LogzSingleSignOnResource, LogzSingleSignOnResource.Definition, LogzSingleSignOnResource.Update { + private LogzSingleSignOnResourceInner innerObject; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public LogzSingleSignOnProperties properties() { + return this.innerModel().properties(); + } + + public LogzSingleSignOnResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String configurationName; + + public LogzSingleSignOnResourceImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public LogzSingleSignOnResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public LogzSingleSignOnResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + LogzSingleSignOnResourceImpl(String name, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = new LogzSingleSignOnResourceInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public LogzSingleSignOnResourceImpl update() { + return this; + } + + public LogzSingleSignOnResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public LogzSingleSignOnResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + LogzSingleSignOnResourceImpl( + LogzSingleSignOnResourceInner innerObject, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "singleSignOnConfigurations"); + } + + public LogzSingleSignOnResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public LogzSingleSignOnResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOns() + .getWithResponse(resourceGroupName, monitorName, configurationName, context) + .getValue(); + return this; + } + + public LogzSingleSignOnResourceImpl withProperties(LogzSingleSignOnProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzBuilder.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzBuilder.java new file mode 100644 index 0000000000000..5db641336f027 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.CookiePolicy; +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 MicrosoftLogzImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftLogzImpl.class}) +public final class MicrosoftLogzBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 MicrosoftLogzBuilder. + */ + public MicrosoftLogzBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftLogzImpl with the provided parameters. + * + * @return an instance of MicrosoftLogzImpl. + */ + public MicrosoftLogzImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + MicrosoftLogzImpl client = + new MicrosoftLogzImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzImpl.java new file mode 100644 index 0000000000000..c61a6057be837 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MicrosoftLogzImpl.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.logz.fluent.MicrosoftLogz; +import com.azure.resourcemanager.logz.fluent.MonitorsClient; +import com.azure.resourcemanager.logz.fluent.OperationsClient; +import com.azure.resourcemanager.logz.fluent.SingleSignOnsClient; +import com.azure.resourcemanager.logz.fluent.SubAccountTagRulesClient; +import com.azure.resourcemanager.logz.fluent.SubAccountsClient; +import com.azure.resourcemanager.logz.fluent.TagRulesClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MicrosoftLogzImpl type. */ +@ServiceClient(builder = MicrosoftLogzBuilder.class) +public final class MicrosoftLogzImpl implements MicrosoftLogz { + private final ClientLogger logger = new ClientLogger(MicrosoftLogzImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The MonitorsClient object to access its operations. */ + private final MonitorsClient monitors; + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + public MonitorsClient getMonitors() { + return this.monitors; + } + + /** 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 TagRulesClient object to access its operations. */ + private final TagRulesClient tagRules; + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + public TagRulesClient getTagRules() { + return this.tagRules; + } + + /** The SingleSignOnsClient object to access its operations. */ + private final SingleSignOnsClient singleSignOns; + + /** + * Gets the SingleSignOnsClient object to access its operations. + * + * @return the SingleSignOnsClient object. + */ + public SingleSignOnsClient getSingleSignOns() { + return this.singleSignOns; + } + + /** The SubAccountsClient object to access its operations. */ + private final SubAccountsClient subAccounts; + + /** + * Gets the SubAccountsClient object to access its operations. + * + * @return the SubAccountsClient object. + */ + public SubAccountsClient getSubAccounts() { + return this.subAccounts; + } + + /** The SubAccountTagRulesClient object to access its operations. */ + private final SubAccountTagRulesClient subAccountTagRules; + + /** + * Gets the SubAccountTagRulesClient object to access its operations. + * + * @return the SubAccountTagRulesClient object. + */ + public SubAccountTagRulesClient getSubAccountTagRules() { + return this.subAccountTagRules; + } + + /** + * Initializes an instance of MicrosoftLogz client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MicrosoftLogzImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-10-01-preview"; + this.monitors = new MonitorsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.tagRules = new TagRulesClientImpl(this); + this.singleSignOns = new SingleSignOnsClientImpl(this); + this.subAccounts = new SubAccountsClientImpl(this); + this.subAccountTagRules = new SubAccountTagRulesClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(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)); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoredResourceImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoredResourceImpl.java new file mode 100644 index 0000000000000..7d93209c8e0b5 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoredResourceImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.MonitoredResource; + +public final class MonitoredResourceImpl implements MonitoredResource { + private MonitoredResourceInner innerObject; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + MonitoredResourceImpl( + MonitoredResourceInner innerObject, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Boolean sendingMetrics() { + return this.innerModel().sendingMetrics(); + } + + public String reasonForMetricsStatus() { + return this.innerModel().reasonForMetricsStatus(); + } + + public Boolean sendingLogs() { + return this.innerModel().sendingLogs(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String reasonForLogsStatus() { + return this.innerModel().reasonForLogsStatus(); + } + + public MonitoredResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoringTagRulesImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoringTagRulesImpl.java new file mode 100644 index 0000000000000..e48e4bbe33a14 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitoringTagRulesImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.logz.models.MonitoringTagRules; +import com.azure.resourcemanager.logz.models.MonitoringTagRulesProperties; + +public final class MonitoringTagRulesImpl + implements MonitoringTagRules, MonitoringTagRules.Definition, MonitoringTagRules.Update { + private MonitoringTagRulesInner innerObject; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public MonitoringTagRulesProperties properties() { + return this.innerModel().properties(); + } + + public MonitoringTagRulesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String ruleSetName; + + public MonitoringTagRulesImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public MonitoringTagRules create() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdateWithResponse( + resourceGroupName, monitorName, ruleSetName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MonitoringTagRules create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdateWithResponse(resourceGroupName, monitorName, ruleSetName, this.innerModel(), context) + .getValue(); + return this; + } + + MonitoringTagRulesImpl(String name, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = new MonitoringTagRulesInner(); + this.serviceManager = serviceManager; + this.ruleSetName = name; + } + + public MonitoringTagRulesImpl update() { + return this; + } + + public MonitoringTagRules apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdateWithResponse( + resourceGroupName, monitorName, ruleSetName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MonitoringTagRules apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdateWithResponse(resourceGroupName, monitorName, ruleSetName, this.innerModel(), context) + .getValue(); + return this; + } + + MonitoringTagRulesImpl( + MonitoringTagRulesInner innerObject, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + this.ruleSetName = Utils.getValueFromIdByName(innerObject.id(), "tagRules"); + } + + public MonitoringTagRules refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE) + .getValue(); + return this; + } + + public MonitoringTagRules refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, context) + .getValue(); + return this; + } + + public MonitoringTagRulesImpl withProperties(MonitoringTagRulesProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsClientImpl.java new file mode 100644 index 0000000000000..e51cbda28de0b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsClientImpl.java @@ -0,0 +1,1769 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.logz.fluent.MonitorsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceListResponse; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; +import com.azure.resourcemanager.logz.models.MonitoredResourceListResponse; +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 MonitorsClient. */ +public final class MonitorsClientImpl implements MonitorsClient { + private final ClientLogger logger = new ClientLogger(MonitorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MonitorsService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(MicrosoftLogzImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzMonitors to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzMonitor") + private interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/listMonitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Logz/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogzMonitorResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogzMonitorResourceUpdateParameters body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResourcesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink)); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName)); + } + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName, context)); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all monitors under the specified 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 response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String monitorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName) { + return getByResourceGroupAsync(resourceGroupName, monitorName).block(); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 properties of a specific monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzMonitorResourceInner.class, + LogzMonitorResourceInner.class, + Context.NONE); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzMonitorResourceInner.class, + LogzMonitorResourceInner.class, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, body).getSyncPoller(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context) { + return beginCreateAsync(resourceGroupName, monitorName, body, context).getSyncPoller(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String monitorName) { + final LogzMonitorResourceInner body = null; + return beginCreateAsync(resourceGroupName, monitorName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context) { + return beginCreateAsync(resourceGroupName, monitorName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body) { + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create(String resourceGroupName, String monitorName) { + final LogzMonitorResourceInner body = null; + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create( + String resourceGroupName, String monitorName, LogzMonitorResourceInner body, Context context) { + return createAsync(resourceGroupName, monitorName, body, context).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceUpdateParameters body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceUpdateParameters body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, LogzMonitorResourceUpdateParameters body) { + return updateWithResponseAsync(resourceGroupName, monitorName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String monitorName) { + final LogzMonitorResourceUpdateParameters body = null; + return updateWithResponseAsync(resourceGroupName, monitorName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner update(String resourceGroupName, String monitorName) { + final LogzMonitorResourceUpdateParameters body = null; + return updateAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, LogzMonitorResourceUpdateParameters body, Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, body, context).block(); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String monitorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName) { + return beginDeleteAsync(resourceGroupName, monitorName).getSyncPoller(); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, context).getSyncPoller(); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName) { + return beginDeleteAsync(resourceGroupName, monitorName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName) { + deleteAsync(resourceGroupName, monitorName).block(); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, Context context) { + deleteAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsImpl.java new file mode 100644 index 0000000000000..e1e0e312b13cc --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/MonitorsImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.MonitorsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResource; +import com.azure.resourcemanager.logz.models.MonitoredResource; +import com.azure.resourcemanager.logz.models.Monitors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MonitorsImpl implements Monitors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorsImpl.class); + + private final MonitorsClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public MonitorsImpl(MonitorsClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public LogzMonitorResource getByResourceGroup(String resourceGroupName, String monitorName) { + LogzMonitorResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogzMonitorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String monitorName) { + this.serviceClient().delete(resourceGroupName, monitorName); + } + + public void delete(String resourceGroupName, String monitorName, Context context) { + this.serviceClient().delete(resourceGroupName, monitorName, context); + } + + public LogzMonitorResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + this.delete(resourceGroupName, monitorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + this.delete(resourceGroupName, monitorName, context); + } + + private MonitorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + public LogzMonitorResourceImpl define(String name) { + return new LogzMonitorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationResultImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationResultImpl.java new file mode 100644 index 0000000000000..39895a4b17eb4 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.resourcemanager.logz.fluent.models.OperationResultInner; +import com.azure.resourcemanager.logz.models.OperationDisplay; +import com.azure.resourcemanager.logz.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + OperationResultImpl(OperationResultInner innerObject, com.azure.resourcemanager.logz.LogzManager 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 String origin() { + return this.innerModel().origin(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..cc7a367ffe6d0 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsClientImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.OperationsClient; +import com.azure.resourcemanager.logz.fluent.models.OperationResultInner; +import com.azure.resourcemanager.logz.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftLogzImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzOperati") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Logz/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all operations provided by Microsoft.Logz. + * + * @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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @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 result of GET request to list the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..afe9299cf0ba1 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.OperationsClient; +import com.azure.resourcemanager.logz.fluent.models.OperationResultInner; +import com.azure.resourcemanager.logz.models.OperationResult; +import com.azure.resourcemanager.logz.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsClientImpl.java new file mode 100644 index 0000000000000..80dc7095c4187 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsClientImpl.java @@ -0,0 +1,894 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.logz.fluent.SingleSignOnsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner; +import com.azure.resourcemanager.logz.models.LogzSingleSignOnResourceListResponse; +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 SingleSignOnsClient. */ +public final class SingleSignOnsClientImpl implements SingleSignOnsClient { + private final ClientLogger logger = new ClientLogger(SingleSignOnsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SingleSignOnsService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of SingleSignOnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SingleSignOnsClientImpl(MicrosoftLogzImpl client) { + this.service = + RestProxy.create(SingleSignOnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzSingleSignOns to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzSingleS") + private interface SingleSignOnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/singleSignOnConfigurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/singleSignOnConfigurations/{configurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogzSingleSignOnResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/singleSignOnConfigurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzSingleSignOnResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, configurationName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzSingleSignOnResourceInner.class, + LogzSingleSignOnResourceInner.class, + Context.NONE); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzSingleSignOnResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, configurationName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzSingleSignOnResourceInner.class, + LogzSingleSignOnResourceInner.class, + context); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).getSyncPoller(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context) + .getSyncPoller(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String configurationName) { + final LogzSingleSignOnResourceInner body = null; + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName, LogzSingleSignOnResourceInner body) { + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).block(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName) { + final LogzSingleSignOnResourceInner body = null; + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).block(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + LogzSingleSignOnResourceInner body, + Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context).block(); + } + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @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 Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String monitorName, String configurationName) { + return getWithResponseAsync(resourceGroupName, monitorName, configurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzSingleSignOnResourceInner get(String resourceGroupName, String monitorName, String configurationName) { + return getAsync(resourceGroupName, monitorName, configurationName).block(); + } + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @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 Logz single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, configurationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsImpl.java new file mode 100644 index 0000000000000..e75de02211755 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SingleSignOnsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.SingleSignOnsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner; +import com.azure.resourcemanager.logz.models.LogzSingleSignOnResource; +import com.azure.resourcemanager.logz.models.SingleSignOns; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SingleSignOnsImpl implements SingleSignOns { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SingleSignOnsImpl.class); + + private final SingleSignOnsClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public SingleSignOnsImpl( + SingleSignOnsClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new LogzSingleSignOnResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new LogzSingleSignOnResourceImpl(inner1, this.manager())); + } + + public LogzSingleSignOnResource get(String resourceGroupName, String monitorName, String configurationName) { + LogzSingleSignOnResourceInner inner = + this.serviceClient().get(resourceGroupName, monitorName, configurationName); + if (inner != null) { + return new LogzSingleSignOnResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogzSingleSignOnResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LogzSingleSignOnResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "singleSignOnConfigurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", + id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "singleSignOnConfigurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", + id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, context); + } + + private SingleSignOnsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + public LogzSingleSignOnResourceImpl define(String name) { + return new LogzSingleSignOnResourceImpl(name, this.manager()); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesClientImpl.java new file mode 100644 index 0000000000000..1041eda0abe91 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesClientImpl.java @@ -0,0 +1,993 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.SubAccountTagRulesClient; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.logz.models.MonitoringTagRulesListResponse; +import com.azure.resourcemanager.logz.models.SubAccountTagRulesDeleteResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SubAccountTagRulesClient. */ +public final class SubAccountTagRulesClientImpl implements SubAccountTagRulesClient { + private final ClientLogger logger = new ClientLogger(SubAccountTagRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SubAccountTagRulesService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of SubAccountTagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubAccountTagRulesClientImpl(MicrosoftLogzImpl client) { + this.service = + RestProxy.create(SubAccountTagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzSubAccountTagRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzSubAcco") + private interface SubAccountTagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName, String subAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String monitorName, String subAccountName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, subAccountName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, subAccountName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String monitorName, String subAccountName) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, subAccountName)); + } + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, subAccountName, context)); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + final MonitoringTagRulesInner body = null; + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoringTagRulesInner createOrUpdate( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + final MonitoringTagRulesInner body = null; + return createOrUpdateAsync(resourceGroupName, monitorName, subAccountName, ruleSetName, body).block(); + } + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, monitorName, subAccountName, ruleSetName, body, context) + .block(); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + return getWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoringTagRulesInner get( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + return getAsync(resourceGroupName, monitorName, subAccountName, ruleSetName).block(); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName, context).block(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + ruleSetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + return deleteWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName) + .flatMap((SubAccountTagRulesDeleteResponse res) -> Mono.empty()); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + deleteAsync(resourceGroupName, monitorName, subAccountName, ruleSetName).block(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + return deleteWithResponseAsync(resourceGroupName, monitorName, subAccountName, ruleSetName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesImpl.java new file mode 100644 index 0000000000000..5ad73e8cad218 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountTagRulesImpl.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.SubAccountTagRulesClient; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.logz.models.MonitoringTagRules; +import com.azure.resourcemanager.logz.models.SubAccountTagRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SubAccountTagRulesImpl implements SubAccountTagRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAccountTagRulesImpl.class); + + private final SubAccountTagRulesClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public SubAccountTagRulesImpl( + SubAccountTagRulesClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName, String subAccountName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, subAccountName); + return Utils.mapPage(inner, inner1 -> new MonitoringTagRulesImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, subAccountName, context); + return Utils.mapPage(inner, inner1 -> new MonitoringTagRulesImpl(inner1, this.manager())); + } + + public MonitoringTagRules createOrUpdate( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + MonitoringTagRulesInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, monitorName, subAccountName, ruleSetName); + if (inner != null) { + return new MonitoringTagRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse(resourceGroupName, monitorName, subAccountName, ruleSetName, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MonitoringTagRulesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MonitoringTagRules get( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + MonitoringTagRulesInner inner = + this.serviceClient().get(resourceGroupName, monitorName, subAccountName, ruleSetName); + if (inner != null) { + return new MonitoringTagRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, subAccountName, ruleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MonitoringTagRulesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String subAccountName, String ruleSetName) { + this.serviceClient().delete(resourceGroupName, monitorName, subAccountName, ruleSetName); + } + + public Response deleteWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, monitorName, subAccountName, ruleSetName, context); + } + + private SubAccountTagRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsClientImpl.java new file mode 100644 index 0000000000000..866f48ecfded5 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsClientImpl.java @@ -0,0 +1,1677 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.logz.fluent.SubAccountsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceListResponse; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; +import com.azure.resourcemanager.logz.models.MonitoredResourceListResponse; +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 SubAccountsClient. */ +public final class SubAccountsClientImpl implements SubAccountsClient { + private final ClientLogger logger = new ClientLogger(SubAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SubAccountsService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of SubAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubAccountsClientImpl(MicrosoftLogzImpl client) { + this.service = + RestProxy.create(SubAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzSubAccounts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzSubAcco") + private interface SubAccountsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogzMonitorResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogzMonitorResourceUpdateParameters body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/accounts/{subAccountName}/listMonitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResources( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("subAccountName") String subAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResourcesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + } + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, monitorName, subAccountName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzMonitorResourceInner.class, + LogzMonitorResourceInner.class, + Context.NONE); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LogzMonitorResourceInner> beginCreateAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, monitorName, subAccountName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LogzMonitorResourceInner.class, + LogzMonitorResourceInner.class, + context); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, subAccountName, body).getSyncPoller(); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LogzMonitorResourceInner> beginCreate( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + return beginCreateAsync(resourceGroupName, monitorName, subAccountName, body, context).getSyncPoller(); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, subAccountName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, String subAccountName) { + final LogzMonitorResourceInner body = null; + return beginCreateAsync(resourceGroupName, monitorName, subAccountName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + return beginCreateAsync(resourceGroupName, monitorName, subAccountName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + return createAsync(resourceGroupName, monitorName, subAccountName, body).block(); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create(String resourceGroupName, String monitorName, String subAccountName) { + final LogzMonitorResourceInner body = null; + return createAsync(resourceGroupName, monitorName, subAccountName, body).block(); + } + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner create( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + return createAsync(resourceGroupName, monitorName, subAccountName, body, context).block(); + } + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String monitorName, String subAccountName) { + return getWithResponseAsync(resourceGroupName, monitorName, subAccountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner get(String resourceGroupName, String monitorName, String subAccountName) { + return getAsync(resourceGroupName, monitorName, subAccountName).block(); + } + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 sub account under a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, subAccountName, context).block(); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String subAccountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, subAccountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, subAccountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String subAccountName) { + return beginDeleteAsync(resourceGroupName, monitorName, subAccountName).getSyncPoller(); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, subAccountName, context).getSyncPoller(); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String subAccountName) { + return beginDeleteAsync(resourceGroupName, monitorName, subAccountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, subAccountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String subAccountName) { + deleteAsync(resourceGroupName, monitorName, subAccountName).block(); + } + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String subAccountName, Context context) { + deleteAsync(resourceGroupName, monitorName, subAccountName, context).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceUpdateParameters body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceUpdateParameters body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceUpdateParameters body) { + return updateWithResponseAsync(resourceGroupName, monitorName, subAccountName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, String subAccountName) { + final LogzMonitorResourceUpdateParameters body = null; + return updateWithResponseAsync(resourceGroupName, monitorName, subAccountName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogzMonitorResourceInner update(String resourceGroupName, String monitorName, String subAccountName) { + final LogzMonitorResourceUpdateParameters body = null; + return updateAsync(resourceGroupName, monitorName, subAccountName, body).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceUpdateParameters body, + Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, subAccountName, body, context).block(); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName, String subAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (subAccountName == null) { + return Mono.error(new IllegalArgumentException("Parameter subAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + subAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName, String subAccountName) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName, subAccountName), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink)); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName, subAccountName, context), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName, subAccountName)); + } + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + return new PagedIterable<>( + listMonitoredResourcesAsync(resourceGroupName, monitorName, subAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsImpl.java new file mode 100644 index 0000000000000..f1adb6c632c52 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/SubAccountsImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.SubAccountsClient; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.logz.models.LogzMonitorResource; +import com.azure.resourcemanager.logz.models.LogzMonitorResourceUpdateParameters; +import com.azure.resourcemanager.logz.models.MonitoredResource; +import com.azure.resourcemanager.logz.models.SubAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SubAccountsImpl implements SubAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAccountsImpl.class); + + private final SubAccountsClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public SubAccountsImpl(SubAccountsClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new LogzMonitorResourceImpl(inner1, this.manager())); + } + + public LogzMonitorResource create( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body) { + LogzMonitorResourceInner inner = + this.serviceClient().create(resourceGroupName, monitorName, subAccountName, body); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogzMonitorResource create(String resourceGroupName, String monitorName, String subAccountName) { + LogzMonitorResourceInner inner = this.serviceClient().create(resourceGroupName, monitorName, subAccountName); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogzMonitorResource create( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context) { + LogzMonitorResourceInner inner = + this.serviceClient().create(resourceGroupName, monitorName, subAccountName, body, context); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LogzMonitorResource get(String resourceGroupName, String monitorName, String subAccountName) { + LogzMonitorResourceInner inner = this.serviceClient().get(resourceGroupName, monitorName, subAccountName); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, subAccountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogzMonitorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String subAccountName) { + this.serviceClient().delete(resourceGroupName, monitorName, subAccountName); + } + + public void delete(String resourceGroupName, String monitorName, String subAccountName, Context context) { + this.serviceClient().delete(resourceGroupName, monitorName, subAccountName, context); + } + + public LogzMonitorResource update(String resourceGroupName, String monitorName, String subAccountName) { + LogzMonitorResourceInner inner = this.serviceClient().update(resourceGroupName, monitorName, subAccountName); + if (inner != null) { + return new LogzMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceUpdateParameters body, + Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, monitorName, subAccountName, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogzMonitorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName, subAccountName); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName, subAccountName, context); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + private SubAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesClientImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesClientImpl.java new file mode 100644 index 0000000000000..a28c8b9b86e90 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesClientImpl.java @@ -0,0 +1,914 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.TagRulesClient; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.logz.models.MonitoringTagRulesListResponse; +import com.azure.resourcemanager.logz.models.TagRulesDeleteResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TagRulesClient. */ +public final class TagRulesClientImpl implements TagRulesClient { + private final ClientLogger logger = new ClientLogger(TagRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TagRulesService service; + + /** The service client containing this operation class. */ + private final MicrosoftLogzImpl client; + + /** + * Initializes an instance of TagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagRulesClientImpl(MicrosoftLogzImpl client) { + this.service = RestProxy.create(TagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftLogzTagRules to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftLogzTagRule") + private interface TagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logz/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String monitorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName)); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, monitorName, context)); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, MonitoringTagRulesInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, MonitoringTagRulesInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + final MonitoringTagRulesInner body = null; + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoringTagRulesInner createOrUpdate(String resourceGroupName, String monitorName, String ruleSetName) { + final MonitoringTagRulesInner body = null; + return createOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, body).block(); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body, context).block(); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MonitoringTagRulesInner get(String resourceGroupName, String monitorName, String ruleSetName) { + return getAsync(resourceGroupName, monitorName, ruleSetName).block(); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName) + .flatMap((TagRulesDeleteResponse res) -> Mono.empty()); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String ruleSetName) { + deleteAsync(resourceGroupName, monitorName, ruleSetName).block(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesImpl.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesImpl.java new file mode 100644 index 0000000000000..5819083f9f722 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/TagRulesImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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.logz.fluent.TagRulesClient; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.logz.models.MonitoringTagRules; +import com.azure.resourcemanager.logz.models.TagRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TagRulesImpl implements TagRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagRulesImpl.class); + + private final TagRulesClient innerClient; + + private final com.azure.resourcemanager.logz.LogzManager serviceManager; + + public TagRulesImpl(TagRulesClient innerClient, com.azure.resourcemanager.logz.LogzManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new MonitoringTagRulesImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new MonitoringTagRulesImpl(inner1, this.manager())); + } + + public MonitoringTagRules get(String resourceGroupName, String monitorName, String ruleSetName) { + MonitoringTagRulesInner inner = this.serviceClient().get(resourceGroupName, monitorName, ruleSetName); + if (inner != null) { + return new MonitoringTagRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, ruleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MonitoringTagRulesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String ruleSetName) { + this.serviceClient().delete(resourceGroupName, monitorName, ruleSetName); + } + + public Response deleteWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, monitorName, ruleSetName, context); + } + + public MonitoringTagRules getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + this.deleteWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, monitorName, ruleSetName, context); + } + + private TagRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.logz.LogzManager manager() { + return this.serviceManager; + } + + public MonitoringTagRulesImpl define(String name) { + return new MonitoringTagRulesImpl(name, this.manager()); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/Utils.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/Utils.java new file mode 100644 index 0000000000000..e7e56c7c41b87 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/package-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/package-info.java new file mode 100644 index 0000000000000..de37fabad0582 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MicrosoftLogz. null. */ +package com.azure.resourcemanager.logz.implementation; diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ErrorAdditionalInfo.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ErrorAdditionalInfo.java new file mode 100644 index 0000000000000..eaf0a7e89298f --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/FilteringTag.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/FilteringTag.java new file mode 100644 index 0000000000000..1c6ab6395e405 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/FilteringTag.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from + * being monitored. + */ +@Fluent +public final class FilteringTag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FilteringTag.class); + + /* + * The name (also known as the key) of the tag. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the tag. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Valid actions for a filtering tag. Exclusion takes priority over + * inclusion. + */ + @JsonProperty(value = "action") + private TagAction action; + + /** + * Get the name property: The name (also known as the key) of the tag. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name (also known as the key) of the tag. + * + * @param name the name value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the tag. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the tag. + * + * @param value the value value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @return the action value. + */ + public TagAction action() { + return this.action; + } + + /** + * Set the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @param action the action value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withAction(TagAction action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/IdentityProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/IdentityProperties.java new file mode 100644 index 0000000000000..885283b6b2073 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/IdentityProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IdentityProperties model. */ +@Fluent +public final class IdentityProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IdentityProperties.class); + + /* + * The identity ID. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type property. + */ + @JsonProperty(value = "type") + private ManagedIdentityTypes type; + + /** + * Get the principalId property: The identity ID. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + public ManagedIdentityTypes type() { + return this.type; + } + + /** + * Set the type property: The type property. + * + * @param type the type value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withType(ManagedIdentityTypes type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LiftrResourceCategories.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LiftrResourceCategories.java new file mode 100644 index 0000000000000..fcf4cf6e760a3 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LiftrResourceCategories.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LiftrResourceCategories. */ +public final class LiftrResourceCategories extends ExpandableStringEnum { + /** Static value Unknown for LiftrResourceCategories. */ + public static final LiftrResourceCategories UNKNOWN = fromString("Unknown"); + + /** Static value MonitorLogs for LiftrResourceCategories. */ + public static final LiftrResourceCategories MONITOR_LOGS = fromString("MonitorLogs"); + + /** + * Creates or finds a LiftrResourceCategories from its string representation. + * + * @param name a name to look for. + * @return the corresponding LiftrResourceCategories. + */ + @JsonCreator + public static LiftrResourceCategories fromString(String name) { + return fromString(name, LiftrResourceCategories.class); + } + + /** @return known LiftrResourceCategories values. */ + public static Collection values() { + return values(LiftrResourceCategories.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogRules.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogRules.java new file mode 100644 index 0000000000000..772d03bdfc9de --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogRules.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Set of rules for sending logs for the Monitor resource. */ +@Fluent +public final class LogRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogRules.class); + + /* + * Flag specifying if AAD logs should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendAadLogs") + private Boolean sendAadLogs; + + /* + * Flag specifying if subscription logs should be sent for the Monitor + * resource. + */ + @JsonProperty(value = "sendSubscriptionLogs") + private Boolean sendSubscriptionLogs; + + /* + * Flag specifying if activity logs from Azure resources should be sent for + * the Monitor resource. + */ + @JsonProperty(value = "sendActivityLogs") + private Boolean sendActivityLogs; + + /* + * List of filtering tags to be used for capturing logs. This only takes + * effect if SendActivityLogs flag is enabled. If empty, all resources will + * be captured. If only Exclude action is specified, the rules will apply + * to the list of all available resources. If Include actions are + * specified, the rules will only include resources with the associated + * tags. + */ + @JsonProperty(value = "filteringTags") + private List filteringTags; + + /** + * Get the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @return the sendAadLogs value. + */ + public Boolean sendAadLogs() { + return this.sendAadLogs; + } + + /** + * Set the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @param sendAadLogs the sendAadLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendAadLogs(Boolean sendAadLogs) { + this.sendAadLogs = sendAadLogs; + return this; + } + + /** + * Get the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @return the sendSubscriptionLogs value. + */ + public Boolean sendSubscriptionLogs() { + return this.sendSubscriptionLogs; + } + + /** + * Set the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @param sendSubscriptionLogs the sendSubscriptionLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendSubscriptionLogs(Boolean sendSubscriptionLogs) { + this.sendSubscriptionLogs = sendSubscriptionLogs; + return this; + } + + /** + * Get the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @return the sendActivityLogs value. + */ + public Boolean sendActivityLogs() { + return this.sendActivityLogs; + } + + /** + * Set the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @param sendActivityLogs the sendActivityLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendActivityLogs(Boolean sendActivityLogs) { + this.sendActivityLogs = sendActivityLogs; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @return the filteringTags value. + */ + public List filteringTags() { + return this.filteringTags; + } + + /** + * Set the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @param filteringTags the filteringTags value to set. + * @return the LogRules object itself. + */ + public LogRules withFilteringTags(List filteringTags) { + this.filteringTags = filteringTags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filteringTags() != null) { + filteringTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResource.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResource.java new file mode 100644 index 0000000000000..081e73b372854 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResource.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import java.util.Map; + +/** An immutable client-side representation of LogzMonitorResource. */ +public interface LogzMonitorResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Properties specific to the monitor resource. + * + * @return the properties value. + */ + MonitorProperties properties(); + + /** + * Gets the identity property: The identity property. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner object. + * + * @return the inner object. + */ + LogzMonitorResourceInner innerModel(); + + /** The entirety of the LogzMonitorResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The LogzMonitorResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LogzMonitorResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the LogzMonitorResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the LogzMonitorResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the LogzMonitorResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogzMonitorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogzMonitorResource create(Context context); + } + /** The stage of the LogzMonitorResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the LogzMonitorResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties specific to the monitor resource.. + * + * @param properties Properties specific to the monitor resource. + * @return the next definition stage. + */ + WithCreate withProperties(MonitorProperties properties); + } + /** The stage of the LogzMonitorResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity property.. + * + * @param identity The identity property. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + /** + * Begins update for the LogzMonitorResource resource. + * + * @return the stage of resource update. + */ + LogzMonitorResource.Update update(); + + /** The template for LogzMonitorResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogzMonitorResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogzMonitorResource apply(Context context); + } + /** The LogzMonitorResource update stages. */ + interface UpdateStages { + /** The stage of the LogzMonitorResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The new tags of the monitor resource.. + * + * @param tags The new tags of the monitor resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the LogzMonitorResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The set of properties that can be update in a PATCH request to a + * monitor resource.. + * + * @param properties The set of properties that can be update in a PATCH request to a monitor resource. + * @return the next definition stage. + */ + Update withProperties(MonitorUpdateProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogzMonitorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogzMonitorResource refresh(Context context); + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable listMonitoredResources(); + + /** + * List the resources currently being monitored by the Logz monitor 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 response of a list operation. + */ + PagedIterable listMonitoredResources(Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceListResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceListResponse.java new file mode 100644 index 0000000000000..29ca9883cb41b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceListResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list operation. */ +@Fluent +public final class LogzMonitorResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzMonitorResourceListResponse.class); + + /* + * Results of a list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of a list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of a list operation. + * + * @param value the value value to set. + * @return the LogzMonitorResourceListResponse object itself. + */ + public LogzMonitorResourceListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next set of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the LogzMonitorResourceListResponse object itself. + */ + public LogzMonitorResourceListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceUpdateParameters.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceUpdateParameters.java new file mode 100644 index 0000000000000..c0413168282f2 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzMonitorResourceUpdateParameters.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The parameters for a PATCH request to a monitor resource. */ +@Fluent +public final class LogzMonitorResourceUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzMonitorResourceUpdateParameters.class); + + /* + * The set of properties that can be update in a PATCH request to a monitor + * resource. + */ + @JsonProperty(value = "properties") + private MonitorUpdateProperties properties; + + /* + * The new tags of the monitor resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the properties property: The set of properties that can be update in a PATCH request to a monitor resource. + * + * @return the properties value. + */ + public MonitorUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The set of properties that can be update in a PATCH request to a monitor resource. + * + * @param properties the properties value to set. + * @return the LogzMonitorResourceUpdateParameters object itself. + */ + public LogzMonitorResourceUpdateParameters withProperties(MonitorUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: The new tags of the monitor resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The new tags of the monitor resource. + * + * @param tags the tags value to set. + * @return the LogzMonitorResourceUpdateParameters object itself. + */ + public LogzMonitorResourceUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzOrganizationProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzOrganizationProperties.java new file mode 100644 index 0000000000000..2e1d80b92e154 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzOrganizationProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LogzOrganizationProperties model. */ +@Fluent +public final class LogzOrganizationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzOrganizationProperties.class); + + /* + * Name of the Logz organization. + */ + @JsonProperty(value = "companyName") + private String companyName; + + /* + * Id of the Logz organization. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The Id of the Enterprise App used for Single sign on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /** + * Get the companyName property: Name of the Logz organization. + * + * @return the companyName value. + */ + public String companyName() { + return this.companyName; + } + + /** + * Set the companyName property: Name of the Logz organization. + * + * @param companyName the companyName value to set. + * @return the LogzOrganizationProperties object itself. + */ + public LogzOrganizationProperties withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get the id property: Id of the Logz organization. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the LogzOrganizationProperties object itself. + */ + public LogzOrganizationProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnProperties.java new file mode 100644 index 0000000000000..018206e074a68 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnProperties.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LogzSingleSignOnProperties model. */ +@Fluent +public final class LogzSingleSignOnProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzSingleSignOnProperties.class); + + /* + * Various states of the SSO resource + */ + @JsonProperty(value = "singleSignOnState") + private SingleSignOnStates singleSignOnState; + + /* + * The Id of the Enterprise App used for Single sign-on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /* + * The login URL specific to this Logz Organization. + */ + @JsonProperty(value = "singleSignOnUrl") + private String singleSignOnUrl; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the singleSignOnState property: Various states of the SSO resource. + * + * @return the singleSignOnState value. + */ + public SingleSignOnStates singleSignOnState() { + return this.singleSignOnState; + } + + /** + * Set the singleSignOnState property: Various states of the SSO resource. + * + * @param singleSignOnState the singleSignOnState value to set. + * @return the LogzSingleSignOnProperties object itself. + */ + public LogzSingleSignOnProperties withSingleSignOnState(SingleSignOnStates singleSignOnState) { + this.singleSignOnState = singleSignOnState; + return this; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the LogzSingleSignOnProperties object itself. + */ + public LogzSingleSignOnProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the singleSignOnUrl property: The login URL specific to this Logz Organization. + * + * @return the singleSignOnUrl value. + */ + public String singleSignOnUrl() { + return this.singleSignOnUrl; + } + + /** + * Set the singleSignOnUrl property: The login URL specific to this Logz Organization. + * + * @param singleSignOnUrl the singleSignOnUrl value to set. + * @return the LogzSingleSignOnProperties object itself. + */ + public LogzSingleSignOnProperties withSingleSignOnUrl(String singleSignOnUrl) { + this.singleSignOnUrl = singleSignOnUrl; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResource.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResource.java new file mode 100644 index 0000000000000..8adc57707daeb --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResource.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner; + +/** An immutable client-side representation of LogzSingleSignOnResource. */ +public interface LogzSingleSignOnResource { + /** + * 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 systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + LogzSingleSignOnProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner object. + * + * @return the inner object. + */ + LogzSingleSignOnResourceInner innerModel(); + + /** The entirety of the LogzSingleSignOnResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LogzSingleSignOnResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LogzSingleSignOnResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LogzSingleSignOnResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the LogzSingleSignOnResource 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. + */ + LogzSingleSignOnResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogzSingleSignOnResource create(Context context); + } + /** The stage of the LogzSingleSignOnResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties property.. + * + * @param properties The properties property. + * @return the next definition stage. + */ + WithCreate withProperties(LogzSingleSignOnProperties properties); + } + } + /** + * Begins update for the LogzSingleSignOnResource resource. + * + * @return the stage of resource update. + */ + LogzSingleSignOnResource.Update update(); + + /** The template for LogzSingleSignOnResource update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogzSingleSignOnResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogzSingleSignOnResource apply(Context context); + } + /** The LogzSingleSignOnResource update stages. */ + interface UpdateStages { + /** The stage of the LogzSingleSignOnResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties property.. + * + * @param properties The properties property. + * @return the next definition stage. + */ + Update withProperties(LogzSingleSignOnProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogzSingleSignOnResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogzSingleSignOnResource refresh(Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResourceListResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResourceListResponse.java new file mode 100644 index 0000000000000..793256c1b701f --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/LogzSingleSignOnResourceListResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.models.LogzSingleSignOnResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list operation. */ +@Fluent +public final class LogzSingleSignOnResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogzSingleSignOnResourceListResponse.class); + + /* + * Results of a list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of a list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of a list operation. + * + * @param value the value value to set. + * @return the LogzSingleSignOnResourceListResponse object itself. + */ + public LogzSingleSignOnResourceListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next set of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the LogzSingleSignOnResourceListResponse object itself. + */ + public LogzSingleSignOnResourceListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ManagedIdentityTypes.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ManagedIdentityTypes.java new file mode 100644 index 0000000000000..5498fe39f6728 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ManagedIdentityTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedIdentityTypes. */ +public final class ManagedIdentityTypes extends ExpandableStringEnum { + /** Static value SystemAssigned for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates or finds a ManagedIdentityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedIdentityTypes. + */ + @JsonCreator + public static ManagedIdentityTypes fromString(String name) { + return fromString(name, ManagedIdentityTypes.class); + } + + /** @return known ManagedIdentityTypes values. */ + public static Collection values() { + return values(ManagedIdentityTypes.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MarketplaceSubscriptionStatus.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 0000000000000..da01cb514dd29 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MarketplaceSubscriptionStatus. */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** Static value Active for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus ACTIVE = fromString("Active"); + + /** Static value Suspended for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + @JsonCreator + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** @return known MarketplaceSubscriptionStatus values. */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorProperties.java new file mode 100644 index 0000000000000..c017cab155db5 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorProperties.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties specific to the monitor resource. */ +@Fluent +public final class MonitorProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorProperties.class); + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Flag specifying if the resource monitoring is enabled or disabled. + */ + @JsonProperty(value = "monitoringStatus") + private MonitoringStatus monitoringStatus; + + /* + * Flag specifying the Marketplace Subscription Status of the resource. If + * payment is not made in time, the resource will go in Suspended state. + */ + @JsonProperty(value = "marketplaceSubscriptionStatus") + private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus; + + /* + * The logzOrganizationProperties property. + */ + @JsonProperty(value = "logzOrganizationProperties") + private LogzOrganizationProperties logzOrganizationProperties; + + /* + * The userInfo property. + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * The planData property. + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * The liftrResourceCategory property. + */ + @JsonProperty(value = "liftrResourceCategory", access = JsonProperty.Access.WRITE_ONLY) + private LiftrResourceCategories liftrResourceCategory; + + /* + * The priority of the resource. + */ + @JsonProperty(value = "liftrResourcePreference", access = JsonProperty.Access.WRITE_ONLY) + private Integer liftrResourcePreference; + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.monitoringStatus; + } + + /** + * Set the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled. + * + * @param monitoringStatus the monitoringStatus value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withMonitoringStatus(MonitoringStatus monitoringStatus) { + this.monitoringStatus = monitoringStatus; + return this; + } + + /** + * Get the marketplaceSubscriptionStatus property: Flag specifying the Marketplace Subscription Status of the + * resource. If payment is not made in time, the resource will go in Suspended state. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.marketplaceSubscriptionStatus; + } + + /** + * Set the marketplaceSubscriptionStatus property: Flag specifying the Marketplace Subscription Status of the + * resource. If payment is not made in time, the resource will go in Suspended state. + * + * @param marketplaceSubscriptionStatus the marketplaceSubscriptionStatus value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withMarketplaceSubscriptionStatus( + MarketplaceSubscriptionStatus marketplaceSubscriptionStatus) { + this.marketplaceSubscriptionStatus = marketplaceSubscriptionStatus; + return this; + } + + /** + * Get the logzOrganizationProperties property: The logzOrganizationProperties property. + * + * @return the logzOrganizationProperties value. + */ + public LogzOrganizationProperties logzOrganizationProperties() { + return this.logzOrganizationProperties; + } + + /** + * Set the logzOrganizationProperties property: The logzOrganizationProperties property. + * + * @param logzOrganizationProperties the logzOrganizationProperties value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withLogzOrganizationProperties(LogzOrganizationProperties logzOrganizationProperties) { + this.logzOrganizationProperties = logzOrganizationProperties; + return this; + } + + /** + * Get the userInfo property: The userInfo property. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: The userInfo property. + * + * @param userInfo the userInfo value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + return this; + } + + /** + * Get the planData property: The planData property. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: The planData property. + * + * @param planData the planData value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the liftrResourceCategory property: The liftrResourceCategory property. + * + * @return the liftrResourceCategory value. + */ + public LiftrResourceCategories liftrResourceCategory() { + return this.liftrResourceCategory; + } + + /** + * Get the liftrResourcePreference property: The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + public Integer liftrResourcePreference() { + return this.liftrResourcePreference; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logzOrganizationProperties() != null) { + logzOrganizationProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorUpdateProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorUpdateProperties.java new file mode 100644 index 0000000000000..5d77664508e38 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorUpdateProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The set of properties that can be update in a PATCH request to a monitor resource. */ +@Fluent +public final class MonitorUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorUpdateProperties.class); + + /* + * Flag specifying if the resource monitoring is enabled or disabled. + */ + @JsonProperty(value = "monitoringStatus") + private MonitoringStatus monitoringStatus; + + /** + * Get the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.monitoringStatus; + } + + /** + * Set the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled. + * + * @param monitoringStatus the monitoringStatus value to set. + * @return the MonitorUpdateProperties object itself. + */ + public MonitorUpdateProperties withMonitoringStatus(MonitoringStatus monitoringStatus) { + this.monitoringStatus = monitoringStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResource.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResource.java new file mode 100644 index 0000000000000..b71a24013726d --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResource.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; + +/** An immutable client-side representation of MonitoredResource. */ +public interface MonitoredResource { + /** + * Gets the id property: The ARM id of the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the sendingMetrics property: Flag indicating if resource is sending metrics to Logz. + * + * @return the sendingMetrics value. + */ + Boolean sendingMetrics(); + + /** + * Gets the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + String reasonForMetricsStatus(); + + /** + * Gets the sendingLogs property: Flag indicating if resource is sending logs to Logz. + * + * @return the sendingLogs value. + */ + Boolean sendingLogs(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + String reasonForLogsStatus(); + + /** + * Gets the inner com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner object. + * + * @return the inner object. + */ + MonitoredResourceInner innerModel(); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResourceListResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResourceListResponse.java new file mode 100644 index 0000000000000..37b94af2ed0ae --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoredResourceListResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.models.MonitoredResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list operation. */ +@Fluent +public final class MonitoredResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoredResourceListResponse.class); + + /* + * Results of a list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of a list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of a list operation. + * + * @param value the value value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next set of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringStatus.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringStatus.java new file mode 100644 index 0000000000000..ed1f0bfe03815 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MonitoringStatus. */ +public final class MonitoringStatus extends ExpandableStringEnum { + /** Static value Enabled for MonitoringStatus. */ + public static final MonitoringStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for MonitoringStatus. */ + public static final MonitoringStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a MonitoringStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MonitoringStatus. + */ + @JsonCreator + public static MonitoringStatus fromString(String name) { + return fromString(name, MonitoringStatus.class); + } + + /** @return known MonitoringStatus values. */ + public static Collection values() { + return values(MonitoringStatus.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRules.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRules.java new file mode 100644 index 0000000000000..0683fdba468be --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRules.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; + +/** An immutable client-side representation of MonitoringTagRules. */ +public interface MonitoringTagRules { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Definition of the properties for a TagRules resource. + * + * @return the properties value. + */ + MonitoringTagRulesProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner object. + * + * @return the inner object. + */ + MonitoringTagRulesInner innerModel(); + + /** The entirety of the MonitoringTagRules definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The MonitoringTagRules definition stages. */ + interface DefinitionStages { + /** The first stage of the MonitoringTagRules definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the MonitoringTagRules definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the MonitoringTagRules 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. + */ + MonitoringTagRules create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MonitoringTagRules create(Context context); + } + /** The stage of the MonitoringTagRules definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Definition of the properties for a TagRules resource.. + * + * @param properties Definition of the properties for a TagRules resource. + * @return the next definition stage. + */ + WithCreate withProperties(MonitoringTagRulesProperties properties); + } + } + /** + * Begins update for the MonitoringTagRules resource. + * + * @return the stage of resource update. + */ + MonitoringTagRules.Update update(); + + /** The template for MonitoringTagRules update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MonitoringTagRules apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MonitoringTagRules apply(Context context); + } + /** The MonitoringTagRules update stages. */ + interface UpdateStages { + /** The stage of the MonitoringTagRules update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Definition of the properties for a TagRules resource.. + * + * @param properties Definition of the properties for a TagRules resource. + * @return the next definition stage. + */ + Update withProperties(MonitoringTagRulesProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MonitoringTagRules refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MonitoringTagRules refresh(Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesListResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesListResponse.java new file mode 100644 index 0000000000000..69810abfbb7d4 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesListResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list operation. */ +@Fluent +public final class MonitoringTagRulesListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoringTagRulesListResponse.class); + + /* + * Results of a list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of a list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of a list operation. + * + * @param value the value value to set. + * @return the MonitoringTagRulesListResponse object itself. + */ + public MonitoringTagRulesListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next set of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the MonitoringTagRulesListResponse object itself. + */ + public MonitoringTagRulesListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesProperties.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesProperties.java new file mode 100644 index 0000000000000..d0a8ee08ce5bf --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitoringTagRulesProperties.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the properties for a TagRules resource. */ +@Fluent +public final class MonitoringTagRulesProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoringTagRulesProperties.class); + + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the MonitoringTagRulesProperties object itself. + */ + public MonitoringTagRulesProperties withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Monitors.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Monitors.java new file mode 100644 index 0000000000000..d00f68fb7c122 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Monitors.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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 Monitors. */ +public interface Monitors { + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the Logz monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * List all monitors under the specified 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 response of a list operation. + */ + PagedIterable list(); + + /** + * List all monitors under the specified 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 response of a list operation. + */ + PagedIterable list(Context context); + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 properties of a specific monitor resource. + */ + LogzMonitorResource getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 properties of a specific monitor resource. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, Context context); + + /** + * Get the properties of a specific monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a specific monitor resource. + */ + LogzMonitorResource getById(String id); + + /** + * Get the properties of a specific monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a specific monitor resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LogzMonitorResource resource. + * + * @param name resource name. + * @return the first stage of the new LogzMonitorResource definition. + */ + LogzMonitorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteHeaders.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteHeaders.java new file mode 100644 index 0000000000000..4038ea21ed57f --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MonitorsDeleteHeaders model. */ +@Fluent +public final class MonitorsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorsDeleteHeaders.class); + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the MonitorsDeleteHeaders object itself. + */ + public MonitorsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteResponse.java new file mode 100644 index 0000000000000..9dbee6ad6d324 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/MonitorsDeleteResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class MonitorsDeleteResponse extends ResponseBase { + /** + * Creates an instance of MonitorsDeleteResponse. + * + * @param request the request which resulted in this MonitorsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public MonitorsDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, MonitorsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationDisplay.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationDisplay.java new file mode 100644 index 0000000000000..5427c7d3f0741 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider, i.e., Microsoft.Logz. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Type on which the operation is performed, e.g., 'monitors'. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type, e.g., read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation, e.g., 'Write monitors'. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider, i.e., Microsoft.Logz. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider, i.e., Microsoft.Logz. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Type on which the operation is performed, e.g., 'monitors'. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Type on which the operation is performed, e.g., 'monitors'. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type, e.g., read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type, e.g., read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation, e.g., 'Write monitors'. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation, e.g., 'Write monitors'. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationListResult.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationListResult.java new file mode 100644 index 0000000000000..b52d4872ac19d --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.logz.fluent.models.OperationResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of GET request to list the Microsoft.Logz operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Microsoft.Logz provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by the Microsoft.Logz provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Microsoft.Logz provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationResult.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationResult.java new file mode 100644 index 0000000000000..28a747bd9369b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/OperationResult.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.resourcemanager.logz.fluent.models.OperationResultInner; + +/** An immutable client-side representation of OperationResult. */ +public interface OperationResult { + /** + * Gets the name property: Operation name, i.e., {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the inner com.azure.resourcemanager.logz.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Operations.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Operations.java new file mode 100644 index 0000000000000..131a28fbe86b2 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List all operations provided by Microsoft.Logz. + * + * @throws com.azure.core.management.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 result of GET request to list the Microsoft. + */ + PagedIterable list(); + + /** + * List all operations provided by Microsoft.Logz. + * + * @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 result of GET request to list the Microsoft. + */ + PagedIterable list(Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/PlanData.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/PlanData.java new file mode 100644 index 0000000000000..52d2fa079ed5c --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/PlanData.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The PlanData model. */ +@Fluent +public final class PlanData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PlanData.class); + + /* + * different usage type like PAYG/COMMITTED. this could be enum + */ + @JsonProperty(value = "usageType") + private String usageType; + + /* + * different billing cycles like MONTHLY/WEEKLY. this could be enum + */ + @JsonProperty(value = "billingCycle") + private String billingCycle; + + /* + * plan id as published by Logz + */ + @JsonProperty(value = "planDetails") + private String planDetails; + + /* + * date when plan was applied + */ + @JsonProperty(value = "effectiveDate") + private OffsetDateTime effectiveDate; + + /** + * Get the usageType property: different usage type like PAYG/COMMITTED. this could be enum. + * + * @return the usageType value. + */ + public String usageType() { + return this.usageType; + } + + /** + * Set the usageType property: different usage type like PAYG/COMMITTED. this could be enum. + * + * @param usageType the usageType value to set. + * @return the PlanData object itself. + */ + public PlanData withUsageType(String usageType) { + this.usageType = usageType; + return this; + } + + /** + * Get the billingCycle property: different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @return the billingCycle value. + */ + public String billingCycle() { + return this.billingCycle; + } + + /** + * Set the billingCycle property: different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @param billingCycle the billingCycle value to set. + * @return the PlanData object itself. + */ + public PlanData withBillingCycle(String billingCycle) { + this.billingCycle = billingCycle; + return this; + } + + /** + * Get the planDetails property: plan id as published by Logz. + * + * @return the planDetails value. + */ + public String planDetails() { + return this.planDetails; + } + + /** + * Set the planDetails property: plan id as published by Logz. + * + * @param planDetails the planDetails value to set. + * @return the PlanData object itself. + */ + public PlanData withPlanDetails(String planDetails) { + this.planDetails = planDetails; + return this; + } + + /** + * Get the effectiveDate property: date when plan was applied. + * + * @return the effectiveDate value. + */ + public OffsetDateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Set the effectiveDate property: date when plan was applied. + * + * @param effectiveDate the effectiveDate value to set. + * @return the PlanData object itself. + */ + public PlanData withEffectiveDate(OffsetDateTime effectiveDate) { + this.effectiveDate = effectiveDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ProvisioningState.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ProvisioningState.java new file mode 100644 index 0000000000000..46d861ec71390 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/ProvisioningState.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOnStates.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOnStates.java new file mode 100644 index 0000000000000..1bd8d44299f68 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOnStates.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SingleSignOnStates. */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** Static value Initial for SingleSignOnStates. */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** Static value Enable for SingleSignOnStates. */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** Static value Disable for SingleSignOnStates. */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** Static value Existing for SingleSignOnStates. */ + public static final SingleSignOnStates EXISTING = fromString("Existing"); + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + @JsonCreator + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** @return known SingleSignOnStates values. */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOns.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOns.java new file mode 100644 index 0000000000000..56931252fc3af --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SingleSignOns.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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 SingleSignOns. */ +public interface SingleSignOns { + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Logz single sign-on resource for the given Monitor. + */ + LogzSingleSignOnResource get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param configurationName The configurationName parameter. + * @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 Logz single sign-on resource for the given Monitor. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @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 Logz single sign-on resource for the given Monitor. + */ + LogzSingleSignOnResource getById(String id); + + /** + * Gets the Logz single sign-on resource for the given Monitor. + * + * @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 Logz single sign-on resource for the given Monitor. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LogzSingleSignOnResource resource. + * + * @param name resource name. + * @return the first stage of the new LogzSingleSignOnResource definition. + */ + LogzSingleSignOnResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRules.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRules.java new file mode 100644 index 0000000000000..0e508cd7cc22b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRules.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.MonitoringTagRulesInner; + +/** Resource collection API of SubAccountTagRules. */ +public interface SubAccountTagRules { + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName, String subAccountName); + + /** + * List the tag rules for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 response of a list operation. + */ + PagedIterable list( + String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 capture logs and metrics of Azure resources based on ARM tags. + */ + MonitoringTagRules createOrUpdate( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Create or update a tag rule set for a given sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @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 capture logs and metrics of Azure resources based on ARM tags. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 tag rule set for a given monitor resource. + */ + MonitoringTagRules get(String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String subAccountName, String ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, String monitorName, String subAccountName, String ruleSetName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteHeaders.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteHeaders.java new file mode 100644 index 0000000000000..f7516fed5284b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SubAccountTagRulesDeleteHeaders model. */ +@Fluent +public final class SubAccountTagRulesDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAccountTagRulesDeleteHeaders.class); + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the SubAccountTagRulesDeleteHeaders object itself. + */ + public SubAccountTagRulesDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteResponse.java new file mode 100644 index 0000000000000..b0a654b404164 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountTagRulesDeleteResponse.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class SubAccountTagRulesDeleteResponse extends ResponseBase { + /** + * Creates an instance of SubAccountTagRulesDeleteResponse. + * + * @param request the request which resulted in this SubAccountTagRulesDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SubAccountTagRulesDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + SubAccountTagRulesDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccounts.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccounts.java new file mode 100644 index 0000000000000..578560016d6e1 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccounts.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.logz.fluent.models.LogzMonitorResourceInner; + +/** Resource collection API of SubAccounts. */ +public interface SubAccounts { + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + LogzMonitorResource create( + String resourceGroupName, String monitorName, String subAccountName, LogzMonitorResourceInner body); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + LogzMonitorResource create(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Create sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The body parameter. + * @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. + */ + LogzMonitorResource create( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceInner body, + Context context); + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sub account under a given monitor resource. + */ + LogzMonitorResource get(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Get a sub account under a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 sub account under a given monitor resource. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Delete a sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String subAccountName, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + LogzMonitorResource update(String resourceGroupName, String monitorName, String subAccountName); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @param body The parameters for a PATCH request to a monitor 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 response. + */ + Response updateWithResponse( + String resourceGroupName, + String monitorName, + String subAccountName, + LogzMonitorResourceUpdateParameters body, + Context context); + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName); + + /** + * List the resources currently being monitored by the Logz sub account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param subAccountName Sub Account resource name. + * @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 response of a list operation. + */ + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, String subAccountName, Context context); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteHeaders.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteHeaders.java new file mode 100644 index 0000000000000..20922cc8cf30b --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SubAccountsDeleteHeaders model. */ +@Fluent +public final class SubAccountsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubAccountsDeleteHeaders.class); + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the SubAccountsDeleteHeaders object itself. + */ + public SubAccountsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteResponse.java new file mode 100644 index 0000000000000..0c06f810075eb --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/SubAccountsDeleteResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class SubAccountsDeleteResponse extends ResponseBase { + /** + * Creates an instance of SubAccountsDeleteResponse. + * + * @param request the request which resulted in this SubAccountsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SubAccountsDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, SubAccountsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagAction.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagAction.java new file mode 100644 index 0000000000000..84c643011b510 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagAction.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TagAction. */ +public final class TagAction extends ExpandableStringEnum { + /** Static value Include for TagAction. */ + public static final TagAction INCLUDE = fromString("Include"); + + /** Static value Exclude for TagAction. */ + public static final TagAction EXCLUDE = fromString("Exclude"); + + /** + * Creates or finds a TagAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding TagAction. + */ + @JsonCreator + public static TagAction fromString(String name) { + return fromString(name, TagAction.class); + } + + /** @return known TagAction values. */ + public static Collection values() { + return values(TagAction.class); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRules.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRules.java new file mode 100644 index 0000000000000..3a2ff7d1d2965 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRules.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.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 TagRules. */ +public interface TagRules { + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName); + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @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 response of a list operation. + */ + PagedIterable list(String resourceGroupName, String monitorName, Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 tag rule set for a given monitor resource. + */ + MonitoringTagRules get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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 tag rule set for a given monitor resource. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Monitor resource name. + * @param ruleSetName The ruleSetName parameter. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule set for a given monitor resource. + */ + MonitoringTagRules getById(String id); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule set for a given monitor resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MonitoringTagRules resource. + * + * @param name resource name. + * @return the first stage of the new MonitoringTagRules definition. + */ + MonitoringTagRules.DefinitionStages.Blank define(String name); +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteHeaders.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteHeaders.java new file mode 100644 index 0000000000000..304f6abd50446 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TagRulesDeleteHeaders model. */ +@Fluent +public final class TagRulesDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagRulesDeleteHeaders.class); + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the TagRulesDeleteHeaders object itself. + */ + public TagRulesDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteResponse.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteResponse.java new file mode 100644 index 0000000000000..df72be667ec75 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/TagRulesDeleteResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class TagRulesDeleteResponse extends ResponseBase { + /** + * Creates an instance of TagRulesDeleteResponse. + * + * @param request the request which resulted in this TagRulesDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public TagRulesDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, TagRulesDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/UserInfo.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/UserInfo.java new file mode 100644 index 0000000000000..3ebdc7da757bd --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/UserInfo.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.logz.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserInfo model. */ +@Fluent +public final class UserInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserInfo.class); + + /* + * First Name of the user + */ + @JsonProperty(value = "firstName") + private String firstName; + + /* + * Last Name of the user + */ + @JsonProperty(value = "lastName") + private String lastName; + + /* + * Email of the user used by Logz for contacting them if needed + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * Phone number of the user used by Logz for contacting them if needed + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Get the firstName property: First Name of the user. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First Name of the user. + * + * @param firstName the firstName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last Name of the user. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last Name of the user. + * + * @param lastName the lastName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: Email of the user used by Logz for contacting them if needed. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email of the user used by Logz for contacting them if needed. + * + * @param emailAddress the emailAddress value to set. + * @return the UserInfo object itself. + */ + public UserInfo withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the phoneNumber property: Phone number of the user used by Logz for contacting them if needed. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number of the user used by Logz for contacting them if needed. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserInfo object itself. + */ + public UserInfo withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/package-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/package-info.java new file mode 100644 index 0000000000000..4c0527e0802e8 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MicrosoftLogz. null. */ +package com.azure.resourcemanager.logz.models; diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/package-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/package-info.java new file mode 100644 index 0000000000000..c622a2d0305c7 --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/com/azure/resourcemanager/logz/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MicrosoftLogz. null. */ +package com.azure.resourcemanager.logz; diff --git a/sdk/logz/azure-resourcemanager-logz/src/main/java/module-info.java b/sdk/logz/azure-resourcemanager-logz/src/main/java/module-info.java new file mode 100644 index 0000000000000..bce5a0383b2bf --- /dev/null +++ b/sdk/logz/azure-resourcemanager-logz/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.logz { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.logz; + exports com.azure.resourcemanager.logz.fluent; + exports com.azure.resourcemanager.logz.fluent.models; + exports com.azure.resourcemanager.logz.models; + + opens com.azure.resourcemanager.logz.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.logz.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/logz/ci.yml b/sdk/logz/ci.yml new file mode 100644 index 0000000000000..9048a8f37feb0 --- /dev/null +++ b/sdk/logz/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/logz/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/logz/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: logz + Artifacts: + - name: azure-resourcemanager-logz + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerlogz diff --git a/sdk/logz/pom.xml b/sdk/logz/pom.xml new file mode 100644 index 0000000000000..78e9bb58bb92b --- /dev/null +++ b/sdk/logz/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-logz-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-logz + + + +