diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3202d3b0f215f..c4f4477e53146 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-elastic;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..bbe6f17d53a9d 100644 --- a/pom.xml +++ b/pom.xml @@ -593,9 +593,10 @@ sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/deviceupdate sdk/digitaltwins + sdk/elastic sdk/eventgrid sdk/eventhubs sdk/formrecognizer diff --git a/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md new file mode 100644 index 0000000000000..2146a42147567 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-16) + +- Azure Resource Manager Elastic client library for Java. This package contains Microsoft Azure SDK for Elastic Management SDK. Package tag package-2020-07-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/elastic/azure-resourcemanager-elastic/README.md b/sdk/elastic/azure-resourcemanager-elastic/README.md new file mode 100644 index 0000000000000..c438e4155f976 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Elastic client library for Java + +Azure Resource Manager Elastic client library for Java. + +This package contains Microsoft Azure SDK for Elastic Management SDK. Package tag package-2020-07-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-elastic;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-elastic + 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(); +ElasticManager manager = ElasticManager + .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/elastic/azure-resourcemanager-elastic/pom.xml b/sdk/elastic/azure-resourcemanager-elastic/pom.xml new file mode 100644 index 0000000000000..d02f97a29f0a7 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/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-elastic + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Elastic Management + This package contains Microsoft Azure SDK for Elastic Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-07-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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java new file mode 100644 index 0000000000000..919685d0974e7 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic; + +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.elastic.fluent.MicrosoftElastic; +import com.azure.resourcemanager.elastic.implementation.DeploymentInfoesImpl; +import com.azure.resourcemanager.elastic.implementation.MicrosoftElasticBuilder; +import com.azure.resourcemanager.elastic.implementation.MonitoredResourcesImpl; +import com.azure.resourcemanager.elastic.implementation.MonitorsImpl; +import com.azure.resourcemanager.elastic.implementation.OperationsImpl; +import com.azure.resourcemanager.elastic.implementation.TagRulesImpl; +import com.azure.resourcemanager.elastic.models.DeploymentInfoes; +import com.azure.resourcemanager.elastic.models.MonitoredResources; +import com.azure.resourcemanager.elastic.models.Monitors; +import com.azure.resourcemanager.elastic.models.Operations; +import com.azure.resourcemanager.elastic.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 ElasticManager. */ +public final class ElasticManager { + private Operations operations; + + private Monitors monitors; + + private MonitoredResources monitoredResources; + + private DeploymentInfoes deploymentInfoes; + + private TagRules tagRules; + + private final MicrosoftElastic clientObject; + + private ElasticManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftElasticBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Elastic service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Elastic service API instance. + */ + public static ElasticManager 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 ElasticManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ElasticManager.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 Elastic service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Elastic service API instance. + */ + public ElasticManager 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.elastic") + .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 ElasticManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @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 Monitors. */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(clientObject.getMonitors(), this); + } + return monitors; + } + + /** @return Resource collection API of MonitoredResources. */ + public MonitoredResources monitoredResources() { + if (this.monitoredResources == null) { + this.monitoredResources = new MonitoredResourcesImpl(clientObject.getMonitoredResources(), this); + } + return monitoredResources; + } + + /** @return Resource collection API of DeploymentInfoes. */ + public DeploymentInfoes deploymentInfoes() { + if (this.deploymentInfoes == null) { + this.deploymentInfoes = new DeploymentInfoesImpl(clientObject.getDeploymentInfoes(), this); + } + return deploymentInfoes; + } + + /** @return Resource collection API of TagRules. */ + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + } + return tagRules; + } + + /** + * @return Wrapped service client MicrosoftElastic providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MicrosoftElastic serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/DeploymentInfoesClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/DeploymentInfoesClient.java new file mode 100644 index 0000000000000..c027f56d2d6c8 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/DeploymentInfoesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; + +/** An instance of this class provides access to all the operations defined in DeploymentInfoesClient. */ +public interface DeploymentInfoesClient { + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInfoResponseInner list(String resourceGroupName, String monitorName); + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String monitorName, Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MicrosoftElastic.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MicrosoftElastic.java new file mode 100644 index 0000000000000..d08470156bd27 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MicrosoftElastic.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.elastic.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftElastic class. */ +public interface MicrosoftElastic { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + MonitorsClient getMonitors(); + + /** + * Gets the MonitoredResourcesClient object to access its operations. + * + * @return the MonitoredResourcesClient object. + */ + MonitoredResourcesClient getMonitoredResources(); + + /** + * Gets the DeploymentInfoesClient object to access its operations. + * + * @return the DeploymentInfoesClient object. + */ + DeploymentInfoesClient getDeploymentInfoes(); + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + TagRulesClient getTagRules(); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredResourcesClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredResourcesClient.java new file mode 100644 index 0000000000000..7f195abd1304b --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitoredResourcesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.models.MonitoredResourceInner; + +/** An instance of this class provides access to all the operations defined in MonitoredResourcesClient. */ +public interface MonitoredResourcesClient { + /** + * List the resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java new file mode 100644 index 0000000000000..9a354fb207f21 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/MonitorsClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.models.ElasticMonitorResourceInner; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceUpdateParameters; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public interface MonitorsClient { + /** + * 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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) + ElasticMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ElasticMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticMonitorResourceInner create(String resourceGroupName, String monitorName, ElasticMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticMonitorResourceInner create(String resourceGroupName, String monitorName); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticMonitorResourceInner create( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticMonitorResourceInner update(String resourceGroupName, String monitorName); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body, Context context); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/OperationsClient.java new file mode 100644 index 0000000000000..94862fd1bb962 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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.elastic.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.Elastic. + * + * @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.Elastic. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java new file mode 100644 index 0000000000000..03c5d68403002 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/TagRulesClient.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java new file mode 100644 index 0000000000000..4294c587e4bb5 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/DeploymentInfoResponseInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.models.ElasticDeploymentStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource. */ +@Immutable +public final class DeploymentInfoResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentInfoResponseInner.class); + + /* + * The Elastic deployment status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ElasticDeploymentStatus status; + + /* + * Version of the elasticsearch in Elastic cloud deployment. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * RAM capacity of the elasticsearch in Elastic cloud deployment. + */ + @JsonProperty(value = "memoryCapacity", access = JsonProperty.Access.WRITE_ONLY) + private String memoryCapacity; + + /* + * Disk capacity of the elasticsearch in Elastic cloud deployment. + */ + @JsonProperty(value = "diskCapacity", access = JsonProperty.Access.WRITE_ONLY) + private String diskCapacity; + + /** + * Get the status property: The Elastic deployment status. + * + * @return the status value. + */ + public ElasticDeploymentStatus status() { + return this.status; + } + + /** + * Get the version property: Version of the elasticsearch in Elastic cloud deployment. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the memoryCapacity property: RAM capacity of the elasticsearch in Elastic cloud deployment. + * + * @return the memoryCapacity value. + */ + public String memoryCapacity() { + return this.memoryCapacity; + } + + /** + * Get the diskCapacity property: Disk capacity of the elasticsearch in Elastic cloud deployment. + * + * @return the diskCapacity value. + */ + public String diskCapacity() { + return this.diskCapacity; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticMonitorResourceInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticMonitorResourceInner.java new file mode 100644 index 0000000000000..e13ebb3f8d72c --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticMonitorResourceInner.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.elastic.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.elastic.models.IdentityProperties; +import com.azure.resourcemanager.elastic.models.MonitorProperties; +import com.azure.resourcemanager.elastic.models.ResourceSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Monitor resource. */ +@Fluent +public final class ElasticMonitorResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticMonitorResourceInner.class); + + /* + * SKU of the monitor resource. + */ + @JsonProperty(value = "sku") + private ResourceSku sku; + + /* + * Properties of the monitor resource. + */ + @JsonProperty(value = "properties") + private MonitorProperties properties; + + /* + * Identity properties of the monitor resource. + */ + @JsonProperty(value = "identity") + private IdentityProperties identity; + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the sku property: SKU of the monitor resource. + * + * @return the sku value. + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the monitor resource. + * + * @param sku the sku value to set. + * @return the ElasticMonitorResourceInner object itself. + */ + public ElasticMonitorResourceInner withSku(ResourceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties of the monitor resource. + * + * @return the properties value. + */ + public MonitorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the monitor resource. + * + * @param properties the properties value to set. + * @return the ElasticMonitorResourceInner object itself. + */ + public ElasticMonitorResourceInner withProperties(MonitorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: Identity properties of the monitor resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: Identity properties of the monitor resource. + * + * @param identity the identity value to set. + * @return the ElasticMonitorResourceInner object itself. + */ + public ElasticMonitorResourceInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ElasticMonitorResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ElasticMonitorResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredResourceInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredResourceInner.java new file mode 100644 index 0000000000000..a8a92699d6f0f --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoredResourceInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.models.SendingLogs; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a resource currently being monitored by the Elastic 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 the status of the resource for sending logs operation to + * Elastic. + */ + @JsonProperty(value = "sendingLogs") + private SendingLogs sendingLogs; + + /* + * 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 sendingLogs property: Flag indicating the status of the resource for sending logs operation to Elastic. + * + * @return the sendingLogs value. + */ + public SendingLogs sendingLogs() { + return this.sendingLogs; + } + + /** + * Set the sendingLogs property: Flag indicating the status of the resource for sending logs operation to Elastic. + * + * @param sendingLogs the sendingLogs value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingLogs(SendingLogs sendingLogs) { + this.sendingLogs = sendingLogs; + return this; + } + + /** + * 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/MonitoringTagRulesInner.java new file mode 100644 index 0000000000000..dafad0b8105e0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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.elastic.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); + + /* + * Properties of the monitoring tag rules. + */ + @JsonProperty(value = "properties") + private MonitoringTagRulesProperties properties; + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the properties property: Properties of the monitoring tag rules. + * + * @return the properties value. + */ + public MonitoringTagRulesProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the monitoring tag rules. + * + * @param properties the properties value to set. + * @return the MonitoringTagRulesInner object itself. + */ + public MonitoringTagRulesInner withProperties(MonitoringTagRulesProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: The system metadata relating to this 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 (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OperationResultInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/OperationResultInner.java new file mode 100644 index 0000000000000..2dd5a884ac17a --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A Microsoft.Elastic 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/package-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/package-info.java new file mode 100644 index 0000000000000..ddaf94ccb52fd --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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 MicrosoftElastic. null. */ +package com.azure.resourcemanager.elastic.fluent.models; diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/package-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/package-info.java new file mode 100644 index 0000000000000..e3ed03980e5fe --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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 MicrosoftElastic. null. */ +package com.azure.resourcemanager.elastic.fluent; diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.java new file mode 100644 index 0000000000000..89cd8dd01d9d6 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoResponseImpl.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.elastic.implementation; + +import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; +import com.azure.resourcemanager.elastic.models.DeploymentInfoResponse; +import com.azure.resourcemanager.elastic.models.ElasticDeploymentStatus; + +public final class DeploymentInfoResponseImpl implements DeploymentInfoResponse { + private DeploymentInfoResponseInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + DeploymentInfoResponseImpl( + DeploymentInfoResponseInner innerObject, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ElasticDeploymentStatus status() { + return this.innerModel().status(); + } + + public String version() { + return this.innerModel().version(); + } + + public String memoryCapacity() { + return this.innerModel().memoryCapacity(); + } + + public String diskCapacity() { + return this.innerModel().diskCapacity(); + } + + public DeploymentInfoResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java new file mode 100644 index 0000000000000..01df16ef2bd46 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesClientImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.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.elastic.fluent.DeploymentInfoesClient; +import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DeploymentInfoesClient. */ +public final class DeploymentInfoesClientImpl implements DeploymentInfoesClient { + private final ClientLogger logger = new ClientLogger(DeploymentInfoesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DeploymentInfoesService service; + + /** The service client containing this operation class. */ + private final MicrosoftElasticImpl client; + + /** + * Initializes an instance of DeploymentInfoesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentInfoesClientImpl(MicrosoftElasticImpl client) { + this.service = + RestProxy.create(DeploymentInfoesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftElasticDeploymentInfoes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftElasticDepl") + private interface DeploymentInfoesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/listDeploymentInfo") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String monitorName) { + return listWithResponseAsync(resourceGroupName, monitorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInfoResponseInner list(String resourceGroupName, String monitorName) { + return listAsync(resourceGroupName, monitorName).block(); + } + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String monitorName, Context context) { + return listWithResponseAsync(resourceGroupName, monitorName, context).block(); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesImpl.java new file mode 100644 index 0000000000000..53ccb8f9bac81 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/DeploymentInfoesImpl.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.elastic.implementation; + +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.elastic.fluent.DeploymentInfoesClient; +import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; +import com.azure.resourcemanager.elastic.models.DeploymentInfoResponse; +import com.azure.resourcemanager.elastic.models.DeploymentInfoes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DeploymentInfoesImpl implements DeploymentInfoes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentInfoesImpl.class); + + private final DeploymentInfoesClient innerClient; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + public DeploymentInfoesImpl( + DeploymentInfoesClient innerClient, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DeploymentInfoResponse list(String resourceGroupName, String monitorName) { + DeploymentInfoResponseInner inner = this.serviceClient().list(resourceGroupName, monitorName); + if (inner != null) { + return new DeploymentInfoResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentInfoResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DeploymentInfoesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java new file mode 100644 index 0000000000000..7572db6dafac0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticMonitorResourceImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResource; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceUpdateParameters; +import com.azure.resourcemanager.elastic.models.IdentityProperties; +import com.azure.resourcemanager.elastic.models.MonitorProperties; +import com.azure.resourcemanager.elastic.models.ResourceSku; +import java.util.Collections; +import java.util.Map; + +public final class ElasticMonitorResourceImpl + implements ElasticMonitorResource, ElasticMonitorResource.Definition, ElasticMonitorResource.Update { + private ElasticMonitorResourceInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager 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 ResourceSku sku() { + return this.innerModel().sku(); + } + + public MonitorProperties properties() { + return this.innerModel().properties(); + } + + public IdentityProperties identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ElasticMonitorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private ElasticMonitorResourceUpdateParameters updateBody; + + public ElasticMonitorResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ElasticMonitorResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public ElasticMonitorResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + ElasticMonitorResourceImpl(String name, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = new ElasticMonitorResourceInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public ElasticMonitorResourceImpl update() { + this.updateBody = new ElasticMonitorResourceUpdateParameters(); + return this; + } + + public ElasticMonitorResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public ElasticMonitorResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, context) + .getValue(); + return this; + } + + ElasticMonitorResourceImpl( + ElasticMonitorResourceInner innerObject, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public ElasticMonitorResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public ElasticMonitorResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public ElasticMonitorResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ElasticMonitorResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ElasticMonitorResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public ElasticMonitorResourceImpl withSku(ResourceSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public ElasticMonitorResourceImpl withProperties(MonitorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ElasticMonitorResourceImpl withIdentity(IdentityProperties identity) { + this.innerModel().withIdentity(identity); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticBuilder.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticBuilder.java new file mode 100644 index 0000000000000..f9c2a3fc8d5be --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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 MicrosoftElasticImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftElasticImpl.class}) +public final class MicrosoftElasticBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder 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 MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder 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 MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder 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 MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder 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 MicrosoftElasticBuilder. + */ + public MicrosoftElasticBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftElasticImpl with the provided parameters. + * + * @return an instance of MicrosoftElasticImpl. + */ + public MicrosoftElasticImpl 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(); + } + MicrosoftElasticImpl client = + new MicrosoftElasticImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticImpl.java new file mode 100644 index 0000000000000..c8a40fd03e9f0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MicrosoftElasticImpl.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.DeploymentInfoesClient; +import com.azure.resourcemanager.elastic.fluent.MicrosoftElastic; +import com.azure.resourcemanager.elastic.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.elastic.fluent.MonitorsClient; +import com.azure.resourcemanager.elastic.fluent.OperationsClient; +import com.azure.resourcemanager.elastic.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 MicrosoftElasticImpl type. */ +@ServiceClient(builder = MicrosoftElasticBuilder.class) +public final class MicrosoftElasticImpl implements MicrosoftElastic { + private final ClientLogger logger = new ClientLogger(MicrosoftElasticImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The 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 MonitoredResourcesClient object to access its operations. */ + private final MonitoredResourcesClient monitoredResources; + + /** + * Gets the MonitoredResourcesClient object to access its operations. + * + * @return the MonitoredResourcesClient object. + */ + public MonitoredResourcesClient getMonitoredResources() { + return this.monitoredResources; + } + + /** The DeploymentInfoesClient object to access its operations. */ + private final DeploymentInfoesClient deploymentInfoes; + + /** + * Gets the DeploymentInfoesClient object to access its operations. + * + * @return the DeploymentInfoesClient object. + */ + public DeploymentInfoesClient getDeploymentInfoes() { + return this.deploymentInfoes; + } + + /** 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; + } + + /** + * Initializes an instance of MicrosoftElastic 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 Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + MicrosoftElasticImpl( + 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-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.monitoredResources = new MonitoredResourcesClientImpl(this); + this.deploymentInfoes = new DeploymentInfoesClientImpl(this); + this.tagRules = new TagRulesClientImpl(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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourceImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourceImpl.java new file mode 100644 index 0000000000000..5df0ab8c38ab9 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourceImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.elastic.models.MonitoredResource; +import com.azure.resourcemanager.elastic.models.SendingLogs; + +public final class MonitoredResourceImpl implements MonitoredResource { + private MonitoredResourceInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + MonitoredResourceImpl( + MonitoredResourceInner innerObject, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public SendingLogs sendingLogs() { + return this.innerModel().sendingLogs(); + } + + public String reasonForLogsStatus() { + return this.innerModel().reasonForLogsStatus(); + } + + public MonitoredResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java new file mode 100644 index 0000000000000..934ca3acbcd16 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesClientImpl.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.Post; +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.elastic.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.elastic.models.MonitoredResourceListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MonitoredResourcesClient. */ +public final class MonitoredResourcesClientImpl implements MonitoredResourcesClient { + private final ClientLogger logger = new ClientLogger(MonitoredResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MonitoredResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftElasticImpl client; + + /** + * Initializes an instance of MonitoredResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitoredResourcesClientImpl(MicrosoftElasticImpl client) { + this.service = + RestProxy.create(MonitoredResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftElasticMonitoredResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftElasticMoni") + private interface MonitoredResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/listMonitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + 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 Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + 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 Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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)); + } + + /** + * 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesImpl.java new file mode 100644 index 0000000000000..161a33ad13630 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoredResourcesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.elastic.models.MonitoredResource; +import com.azure.resourcemanager.elastic.models.MonitoredResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MonitoredResourcesImpl implements MonitoredResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoredResourcesImpl.class); + + private final MonitoredResourcesClient innerClient; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + public MonitoredResourcesImpl( + MonitoredResourcesClient innerClient, com.azure.resourcemanager.elastic.ElasticManager 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 MonitoredResourceImpl(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 MonitoredResourceImpl(inner1, this.manager())); + } + + private MonitoredResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoringTagRulesImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitoringTagRulesImpl.java new file mode 100644 index 0000000000000..d71947972ca24 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.elastic.models.MonitoringTagRules; +import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; + +public final class MonitoringTagRulesImpl + implements MonitoringTagRules, MonitoringTagRules.Definition, MonitoringTagRules.Update { + private MonitoringTagRulesInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public MonitoringTagRulesProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public MonitoringTagRulesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager 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.elastic.ElasticManager 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.elastic.ElasticManager 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java new file mode 100644 index 0000000000000..79409e03276e1 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsClientImpl.java @@ -0,0 +1,1485 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.elastic.fluent.MonitorsClient; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceListResponse; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceUpdateParameters; +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 MicrosoftElasticImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(MicrosoftElasticImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftElasticMonitors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftElasticMoni") + private interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ElasticMonitorResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") ElasticMonitorResourceUpdateParameters body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @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> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context 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.getApiVersion(), + this.client.getSubscriptionId(), + 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.getApiVersion(), + this.client.getSubscriptionId(), + 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 -> listNextSinglePageAsync(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 -> listNextSinglePageAsync(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 to which the Elastic resource belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + 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 to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + 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 to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 ElasticMonitorResourceInner 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + body, + accept, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ElasticMonitorResourceInner.class, + ElasticMonitorResourceInner.class, + Context.NONE); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ElasticMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ElasticMonitorResourceInner.class, + ElasticMonitorResourceInner.class, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, body).getSyncPoller(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ElasticMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { + return beginCreateAsync(resourceGroupName, monitorName, body, context).getSyncPoller(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String monitorName) { + final ElasticMonitorResourceInner body = null; + return beginCreateAsync(resourceGroupName, monitorName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner create( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body) { + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner create(String resourceGroupName, String monitorName) { + final ElasticMonitorResourceInner body = null; + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic monitor resource model. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner create( + String resourceGroupName, String monitorName, ElasticMonitorResourceInner body, Context context) { + return createAsync(resourceGroupName, monitorName, body, context).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + body, + accept, + context); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters 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 to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String monitorName) { + final ElasticMonitorResourceUpdateParameters 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 to which the Elastic resource belongs. + * @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 monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticMonitorResourceInner update(String resourceGroupName, String monitorName) { + final ElasticMonitorResourceUpdateParameters body = null; + return updateAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param body Elastic resource model update parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return monitor resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, ElasticMonitorResourceUpdateParameters body, Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, body, context).block(); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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> 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> 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsImpl.java new file mode 100644 index 0000000000000..4dd053861d7da --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/MonitorsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.MonitorsClient; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; +import com.azure.resourcemanager.elastic.models.ElasticMonitorResource; +import com.azure.resourcemanager.elastic.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.elastic.ElasticManager serviceManager; + + public MonitorsImpl(MonitorsClient innerClient, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ElasticMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ElasticMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ElasticMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ElasticMonitorResourceImpl(inner1, this.manager())); + } + + public ElasticMonitorResource getByResourceGroup(String resourceGroupName, String monitorName) { + ElasticMonitorResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new ElasticMonitorResourceImpl(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 ElasticMonitorResourceImpl(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 ElasticMonitorResource 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.elastic.ElasticManager manager() { + return this.serviceManager; + } + + public ElasticMonitorResourceImpl define(String name) { + return new ElasticMonitorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationResultImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationResultImpl.java new file mode 100644 index 0000000000000..2ef54d4192c5e --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationResultImpl.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.elastic.implementation; + +import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; +import com.azure.resourcemanager.elastic.models.OperationDisplay; +import com.azure.resourcemanager.elastic.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + OperationResultImpl( + OperationResultInner innerObject, com.azure.resourcemanager.elastic.ElasticManager 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.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..ea0d9ff493847 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.fluent.OperationsClient; +import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; +import com.azure.resourcemanager.elastic.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 MicrosoftElasticImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftElasticImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftElasticOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftElasticOper") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Elastic/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all operations provided by Microsoft.Elastic. + * + * @throws 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(), 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 operations provided by Microsoft.Elastic. + * + * @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(), this.client.getApiVersion(), 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.Elastic. + * + * @throws 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.Elastic. + * + * @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.Elastic. + * + * @throws 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.Elastic. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b4a7570e36cf1 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.OperationsClient; +import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; +import com.azure.resourcemanager.elastic.models.OperationResult; +import com.azure.resourcemanager.elastic.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.elastic.ElasticManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.elastic.ElasticManager 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.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java new file mode 100644 index 0000000000000..0f354166a223d --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesClientImpl.java @@ -0,0 +1,1014 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.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.elastic.fluent.TagRulesClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.elastic.models.MonitoringTagRulesListResponse; +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 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 MicrosoftElasticImpl client; + + /** + * Initializes an instance of TagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagRulesClientImpl(MicrosoftElasticImpl client) { + this.service = RestProxy.create(TagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftElasticTagRules to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftElasticTagR") + private interface TagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @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 to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + 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 to which the Elastic resource belongs. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. + * @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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + body, + accept, + context); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set resource name. + * @param body request body of MonitoringTagRules. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName).getSyncPoller(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context).getSyncPoller(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName) { + deleteAsync(resourceGroupName, monitorName, ruleSetName).block(); + } + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName, Context context) { + deleteAsync(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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesImpl.java new file mode 100644 index 0000000000000..5b6eb0b460b45 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/TagRulesImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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.elastic.fluent.TagRulesClient; +import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.elastic.models.MonitoringTagRules; +import com.azure.resourcemanager.elastic.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.elastic.ElasticManager serviceManager; + + public TagRulesImpl(TagRulesClient innerClient, com.azure.resourcemanager.elastic.ElasticManager 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 void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + this.serviceClient().delete(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.delete(resourceGroupName, monitorName, ruleSetName, 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))); + } + 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.delete(resourceGroupName, monitorName, ruleSetName, context); + } + + private TagRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } + + public MonitoringTagRulesImpl define(String name) { + return new MonitoringTagRulesImpl(name, this.manager()); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/Utils.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/Utils.java new file mode 100644 index 0000000000000..cb3d96477d15b --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/package-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/package-info.java new file mode 100644 index 0000000000000..35f6eca1996fa --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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 MicrosoftElastic. null. */ +package com.azure.resourcemanager.elastic.implementation; diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/CompanyInfo.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/CompanyInfo.java new file mode 100644 index 0000000000000..a95a5864255ce --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/CompanyInfo.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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; + +/** Company information of the user to be passed to partners. */ +@Fluent +public final class CompanyInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CompanyInfo.class); + + /* + * Domain of the company + */ + @JsonProperty(value = "domain") + private String domain; + + /* + * Business of the company + */ + @JsonProperty(value = "business") + private String business; + + /* + * Number of employees in the company + */ + @JsonProperty(value = "employeesNumber") + private String employeesNumber; + + /* + * State of the company location. + */ + @JsonProperty(value = "state") + private String state; + + /* + * Country of the company location. + */ + @JsonProperty(value = "country") + private String country; + + /** + * Get the domain property: Domain of the company. + * + * @return the domain value. + */ + public String domain() { + return this.domain; + } + + /** + * Set the domain property: Domain of the company. + * + * @param domain the domain value to set. + * @return the CompanyInfo object itself. + */ + public CompanyInfo withDomain(String domain) { + this.domain = domain; + return this; + } + + /** + * Get the business property: Business of the company. + * + * @return the business value. + */ + public String business() { + return this.business; + } + + /** + * Set the business property: Business of the company. + * + * @param business the business value to set. + * @return the CompanyInfo object itself. + */ + public CompanyInfo withBusiness(String business) { + this.business = business; + return this; + } + + /** + * Get the employeesNumber property: Number of employees in the company. + * + * @return the employeesNumber value. + */ + public String employeesNumber() { + return this.employeesNumber; + } + + /** + * Set the employeesNumber property: Number of employees in the company. + * + * @param employeesNumber the employeesNumber value to set. + * @return the CompanyInfo object itself. + */ + public CompanyInfo withEmployeesNumber(String employeesNumber) { + this.employeesNumber = employeesNumber; + return this; + } + + /** + * Get the state property: State of the company location. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: State of the company location. + * + * @param state the state value to set. + * @return the CompanyInfo object itself. + */ + public CompanyInfo withState(String state) { + this.state = state; + return this; + } + + /** + * Get the country property: Country of the company location. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: Country of the company location. + * + * @param country the country value to set. + * @return the CompanyInfo object itself. + */ + public CompanyInfo withCountry(String country) { + this.country = country; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.java new file mode 100644 index 0000000000000..97d51d5392145 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoResponse.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.elastic.models; + +import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; + +/** An immutable client-side representation of DeploymentInfoResponse. */ +public interface DeploymentInfoResponse { + /** + * Gets the status property: The Elastic deployment status. + * + * @return the status value. + */ + ElasticDeploymentStatus status(); + + /** + * Gets the version property: Version of the elasticsearch in Elastic cloud deployment. + * + * @return the version value. + */ + String version(); + + /** + * Gets the memoryCapacity property: RAM capacity of the elasticsearch in Elastic cloud deployment. + * + * @return the memoryCapacity value. + */ + String memoryCapacity(); + + /** + * Gets the diskCapacity property: Disk capacity of the elasticsearch in Elastic cloud deployment. + * + * @return the diskCapacity value. + */ + String diskCapacity(); + + /** + * Gets the inner com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner object. + * + * @return the inner object. + */ + DeploymentInfoResponseInner innerModel(); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoes.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoes.java new file mode 100644 index 0000000000000..4b0a2b7ce34db --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/DeploymentInfoes.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.elastic.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DeploymentInfoes. */ +public interface DeploymentInfoes { + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + DeploymentInfoResponse list(String resourceGroupName, String monitorName); + + /** + * Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 deployment in Elastic cloud corresponding to the Elastic monitor resource. + */ + Response listWithResponse(String resourceGroupName, String monitorName, Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudDeployment.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudDeployment.java new file mode 100644 index 0000000000000..a7c159bd79931 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudDeployment.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.elastic.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; + +/** Details of the user's elastic deployment associated with the monitor resource. */ +@Immutable +public final class ElasticCloudDeployment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticCloudDeployment.class); + + /* + * Elastic deployment name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Elastic deployment Id + */ + @JsonProperty(value = "deploymentId", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentId; + + /* + * Associated Azure subscription Id for the elastic deployment. + */ + @JsonProperty(value = "azureSubscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String azureSubscriptionId; + + /* + * Region where Deployment at Elastic side took place. + */ + @JsonProperty(value = "elasticsearchRegion", access = JsonProperty.Access.WRITE_ONLY) + private String elasticsearchRegion; + + /* + * Elasticsearch ingestion endpoint of the Elastic deployment. + */ + @JsonProperty(value = "elasticsearchServiceUrl", access = JsonProperty.Access.WRITE_ONLY) + private String elasticsearchServiceUrl; + + /* + * Kibana endpoint of the Elastic deployment. + */ + @JsonProperty(value = "kibanaServiceUrl", access = JsonProperty.Access.WRITE_ONLY) + private String kibanaServiceUrl; + + /* + * Kibana dashboard sso URL of the Elastic deployment. + */ + @JsonProperty(value = "kibanaSsoUrl", access = JsonProperty.Access.WRITE_ONLY) + private String kibanaSsoUrl; + + /** + * Get the name property: Elastic deployment name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the deploymentId property: Elastic deployment Id. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Get the azureSubscriptionId property: Associated Azure subscription Id for the elastic deployment. + * + * @return the azureSubscriptionId value. + */ + public String azureSubscriptionId() { + return this.azureSubscriptionId; + } + + /** + * Get the elasticsearchRegion property: Region where Deployment at Elastic side took place. + * + * @return the elasticsearchRegion value. + */ + public String elasticsearchRegion() { + return this.elasticsearchRegion; + } + + /** + * Get the elasticsearchServiceUrl property: Elasticsearch ingestion endpoint of the Elastic deployment. + * + * @return the elasticsearchServiceUrl value. + */ + public String elasticsearchServiceUrl() { + return this.elasticsearchServiceUrl; + } + + /** + * Get the kibanaServiceUrl property: Kibana endpoint of the Elastic deployment. + * + * @return the kibanaServiceUrl value. + */ + public String kibanaServiceUrl() { + return this.kibanaServiceUrl; + } + + /** + * Get the kibanaSsoUrl property: Kibana dashboard sso URL of the Elastic deployment. + * + * @return the kibanaSsoUrl value. + */ + public String kibanaSsoUrl() { + return this.kibanaSsoUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudUser.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudUser.java new file mode 100644 index 0000000000000..1455de24cb3b5 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticCloudUser.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.elastic.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; + +/** Details of the user's elastic account. */ +@Immutable +public final class ElasticCloudUser { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticCloudUser.class); + + /* + * Email of the Elastic User Account. + */ + @JsonProperty(value = "emailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String emailAddress; + + /* + * User Id of the elastic account of the User. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Elastic cloud default dashboard sso URL of the Elastic user account. + */ + @JsonProperty(value = "elasticCloudSsoDefaultUrl", access = JsonProperty.Access.WRITE_ONLY) + private String elasticCloudSsoDefaultUrl; + + /** + * Get the emailAddress property: Email of the Elastic User Account. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Get the id property: User Id of the elastic account of the User. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the elasticCloudSsoDefaultUrl property: Elastic cloud default dashboard sso URL of the Elastic user account. + * + * @return the elasticCloudSsoDefaultUrl value. + */ + public String elasticCloudSsoDefaultUrl() { + return this.elasticCloudSsoDefaultUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticDeploymentStatus.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticDeploymentStatus.java new file mode 100644 index 0000000000000..9d0eeeefc6cd7 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticDeploymentStatus.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.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ElasticDeploymentStatus. */ +public final class ElasticDeploymentStatus extends ExpandableStringEnum { + /** Static value Healthy for ElasticDeploymentStatus. */ + public static final ElasticDeploymentStatus HEALTHY = fromString("Healthy"); + + /** Static value Unhealthy for ElasticDeploymentStatus. */ + public static final ElasticDeploymentStatus UNHEALTHY = fromString("Unhealthy"); + + /** + * Creates or finds a ElasticDeploymentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ElasticDeploymentStatus. + */ + @JsonCreator + public static ElasticDeploymentStatus fromString(String name) { + return fromString(name, ElasticDeploymentStatus.class); + } + + /** @return known ElasticDeploymentStatus values. */ + public static Collection values() { + return values(ElasticDeploymentStatus.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java new file mode 100644 index 0000000000000..5a7f1caced623 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResource.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ElasticMonitorResource. */ +public interface ElasticMonitorResource { + /** + * 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 sku property: SKU of the monitor resource. + * + * @return the sku value. + */ + ResourceSku sku(); + + /** + * Gets the properties property: Properties of the monitor resource. + * + * @return the properties value. + */ + MonitorProperties properties(); + + /** + * Gets the identity property: Identity properties of the monitor resource. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner object. + * + * @return the inner object. + */ + ElasticMonitorResourceInner innerModel(); + + /** The entirety of the ElasticMonitorResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ElasticMonitorResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ElasticMonitorResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ElasticMonitorResource 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 ElasticMonitorResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ElasticMonitorResource 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.WithSku, + DefinitionStages.WithProperties, + DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + ElasticMonitorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ElasticMonitorResource create(Context context); + } + /** The stage of the ElasticMonitorResource 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 ElasticMonitorResource definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: SKU of the monitor resource.. + * + * @param sku SKU of the monitor resource. + * @return the next definition stage. + */ + WithCreate withSku(ResourceSku sku); + } + /** The stage of the ElasticMonitorResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the monitor resource.. + * + * @param properties Properties of the monitor resource. + * @return the next definition stage. + */ + WithCreate withProperties(MonitorProperties properties); + } + /** The stage of the ElasticMonitorResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity properties of the monitor resource.. + * + * @param identity Identity properties of the monitor resource. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + /** + * Begins update for the ElasticMonitorResource resource. + * + * @return the stage of resource update. + */ + ElasticMonitorResource.Update update(); + + /** The template for ElasticMonitorResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ElasticMonitorResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ElasticMonitorResource apply(Context context); + } + /** The ElasticMonitorResource update stages. */ + interface UpdateStages { + /** The stage of the ElasticMonitorResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: elastic monitor resource tags.. + * + * @param tags elastic monitor resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ElasticMonitorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ElasticMonitorResource refresh(Context context); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.java new file mode 100644 index 0000000000000..989bb29eed730 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceListResponse.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.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.fluent.models.ElasticMonitorResourceInner; +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 ElasticMonitorResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticMonitorResourceListResponse.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 ElasticMonitorResourceListResponse object itself. + */ + public ElasticMonitorResourceListResponse 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 ElasticMonitorResourceListResponse object itself. + */ + public ElasticMonitorResourceListResponse 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceUpdateParameters.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceUpdateParameters.java new file mode 100644 index 0000000000000..dcc4516af3d6c --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticMonitorResourceUpdateParameters.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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; + +/** Monitor resource update parameters. */ +@Fluent +public final class ElasticMonitorResourceUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticMonitorResourceUpdateParameters.class); + + /* + * elastic monitor resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: elastic monitor resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: elastic monitor resource tags. + * + * @param tags the tags value to set. + * @return the ElasticMonitorResourceUpdateParameters object itself. + */ + public ElasticMonitorResourceUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticProperties.java new file mode 100644 index 0000000000000..266eb2d08d57a --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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; + +/** Elastic Resource Properties. */ +@Fluent +public final class ElasticProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ElasticProperties.class); + + /* + * Details of the user's elastic account. + */ + @JsonProperty(value = "elasticCloudUser") + private ElasticCloudUser elasticCloudUser; + + /* + * Details of the elastic cloud deployment. + */ + @JsonProperty(value = "elasticCloudDeployment") + private ElasticCloudDeployment elasticCloudDeployment; + + /** + * Get the elasticCloudUser property: Details of the user's elastic account. + * + * @return the elasticCloudUser value. + */ + public ElasticCloudUser elasticCloudUser() { + return this.elasticCloudUser; + } + + /** + * Set the elasticCloudUser property: Details of the user's elastic account. + * + * @param elasticCloudUser the elasticCloudUser value to set. + * @return the ElasticProperties object itself. + */ + public ElasticProperties withElasticCloudUser(ElasticCloudUser elasticCloudUser) { + this.elasticCloudUser = elasticCloudUser; + return this; + } + + /** + * Get the elasticCloudDeployment property: Details of the elastic cloud deployment. + * + * @return the elasticCloudDeployment value. + */ + public ElasticCloudDeployment elasticCloudDeployment() { + return this.elasticCloudDeployment; + } + + /** + * Set the elasticCloudDeployment property: Details of the elastic cloud deployment. + * + * @param elasticCloudDeployment the elasticCloudDeployment value to set. + * @return the ElasticProperties object itself. + */ + public ElasticProperties withElasticCloudDeployment(ElasticCloudDeployment elasticCloudDeployment) { + this.elasticCloudDeployment = elasticCloudDeployment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (elasticCloudUser() != null) { + elasticCloudUser().validate(); + } + if (elasticCloudDeployment() != null) { + elasticCloudDeployment().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/FilteringTag.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/FilteringTag.java new file mode 100644 index 0000000000000..958c3234aadb2 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/FilteringTag.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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. + */ + @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. + * + * @return the action value. + */ + public TagAction action() { + return this.action; + } + + /** + * Set the action property: Valid actions for a filtering tag. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/IdentityProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/IdentityProperties.java new file mode 100644 index 0000000000000..e5fb386ea0bbb --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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; + +/** Identity properties. */ +@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; + + /* + * Managed identity type. + */ + @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: Managed identity type. + * + * @return the type value. + */ + public ManagedIdentityTypes type() { + return this.type; + } + + /** + * Set the type property: Managed identity type. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/LiftrResourceCategories.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/LiftrResourceCategories.java new file mode 100644 index 0000000000000..73e21b837d3a5 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/LogRules.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/LogRules.java new file mode 100644 index 0000000000000..50082776f81a8 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ManagedIdentityTypes.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ManagedIdentityTypes.java new file mode 100644 index 0000000000000..c974634ab8c03 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ManagedIdentityTypes.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.elastic.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"); + + /** + * 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java new file mode 100644 index 0000000000000..a118319a59fb6 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitorProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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); + + /* + * Provisioning state of the monitor resource. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * Flag specifying if the resource monitoring is enabled or disabled. + */ + @JsonProperty(value = "monitoringStatus") + private MonitoringStatus monitoringStatus; + + /* + * Elastic cloud properties. + */ + @JsonProperty(value = "elasticProperties") + private ElasticProperties elasticProperties; + + /* + * User information. + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * 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: Provisioning state of the monitor resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of the monitor resource. + * + * @param provisioningState the provisioningState value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * 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 elasticProperties property: Elastic cloud properties. + * + * @return the elasticProperties value. + */ + public ElasticProperties elasticProperties() { + return this.elasticProperties; + } + + /** + * Set the elasticProperties property: Elastic cloud properties. + * + * @param elasticProperties the elasticProperties value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withElasticProperties(ElasticProperties elasticProperties) { + this.elasticProperties = elasticProperties; + return this; + } + + /** + * Get the userInfo property: User information. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User information. + * + * @param userInfo the userInfo value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + 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 (elasticProperties() != null) { + elasticProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResource.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResource.java new file mode 100644 index 0000000000000..3dd54f24d6a24 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResource.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.resourcemanager.elastic.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 sendingLogs property: Flag indicating the status of the resource for sending logs operation to Elastic. + * + * @return the sendingLogs value. + */ + SendingLogs sendingLogs(); + + /** + * 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.elastic.fluent.models.MonitoredResourceInner object. + * + * @return the inner object. + */ + MonitoredResourceInner innerModel(); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResourceListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResourceListResponse.java new file mode 100644 index 0000000000000..293809be72c3b --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResources.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResources.java new file mode 100644 index 0000000000000..387d373a48c92 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoredResources.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.elastic.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of MonitoredResources. */ +public interface MonitoredResources { + /** + * List the resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 resources currently being monitored by the Elastic monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringStatus.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringStatus.java new file mode 100644 index 0000000000000..ebfe005c85dd9 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRules.java new file mode 100644 index 0000000000000..84280acc4afbc --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.elastic.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 properties property: Properties of the monitoring tag rules. + * + * @return the properties value. + */ + MonitoringTagRulesProperties properties(); + + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.elastic.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 to which the Elastic resource belongs. + * @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: Properties of the monitoring tag rules.. + * + * @param properties Properties of the monitoring tag rules. + * @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: Properties of the monitoring tag rules.. + * + * @param properties Properties of the monitoring tag rules. + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesListResponse.java new file mode 100644 index 0000000000000..293adf65cc9f1 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java new file mode 100644 index 0000000000000..577cb15d8303c --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/MonitoringTagRulesProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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; + +/** Definition of the properties for a TagRules resource. */ +@Fluent +public final class MonitoringTagRulesProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoringTagRulesProperties.class); + + /* + * Provisioning state of the monitoring tag rules. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * Rules for sending logs. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /** + * Get the provisioningState property: Provisioning state of the monitoring tag rules. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of the monitoring tag rules. + * + * @param provisioningState the provisioningState value to set. + * @return the MonitoringTagRulesProperties object itself. + */ + public MonitoringTagRulesProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the logRules property: Rules for sending logs. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Rules for sending logs. + * + * @param logRules the logRules value to set. + * @return the MonitoringTagRulesProperties object itself. + */ + public MonitoringTagRulesProperties withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Monitors.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Monitors.java new file mode 100644 index 0000000000000..2508c55c001b0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Monitors.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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 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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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. + */ + ElasticMonitorResource getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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. + */ + ElasticMonitorResource 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 ElasticMonitorResource resource. + * + * @param name resource name. + * @return the first stage of the new ElasticMonitorResource definition. + */ + ElasticMonitorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationDisplay.java new file mode 100644 index 0000000000000..cf72726e7f639 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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.Elastic. + */ + @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.Elastic. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider, i.e., Microsoft.Elastic. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationListResult.java new file mode 100644 index 0000000000000..4fe59677d0018 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.elastic.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.Elastic operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Microsoft.Elastic 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.Elastic provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Microsoft.Elastic 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationResult.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/OperationResult.java new file mode 100644 index 0000000000000..0b986406eabb0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.models; + +import com.azure.resourcemanager.elastic.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.elastic.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/Operations.java new file mode 100644 index 0000000000000..7b8e36ebb68e9 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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.Elastic. + * + * @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.Elastic. + * + * @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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ProvisioningState.java new file mode 100644 index 0000000000000..dd3cf1a2ec77b --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.java new file mode 100644 index 0000000000000..1da7f70d7632f --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ResourceSku.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.elastic.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; + +/** Microsoft.Elastic SKU. */ +@Fluent +public final class ResourceSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSku.class); + + /* + * Name of the SKU. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the name property: Name of the SKU. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the SKU. + * + * @param name the name value to set. + * @return the ResourceSku object itself. + */ + public ResourceSku withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ResourceSku")); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.java new file mode 100644 index 0000000000000..817183260f074 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/SendingLogs.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.elastic.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SendingLogs. */ +public final class SendingLogs extends ExpandableStringEnum { + /** Static value True for SendingLogs. */ + public static final SendingLogs TRUE = fromString("True"); + + /** Static value False for SendingLogs. */ + public static final SendingLogs FALSE = fromString("False"); + + /** + * Creates or finds a SendingLogs from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendingLogs. + */ + @JsonCreator + public static SendingLogs fromString(String name) { + return fromString(name, SendingLogs.class); + } + + /** @return known SendingLogs values. */ + public static Collection values() { + return values(SendingLogs.class); + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/TagAction.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/TagAction.java new file mode 100644 index 0000000000000..e01ff5e814ca0 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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.elastic.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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/TagRules.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/TagRules.java new file mode 100644 index 0000000000000..716e049257187 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/TagRules.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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 to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 ruleSetName); + + /** + * Delete a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Elastic resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Tag Rule Set 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 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. + */ + void 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/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserInfo.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserInfo.java new file mode 100644 index 0000000000000..1539ab4f4f9ae --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserInfo.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.elastic.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; + +/** User Information to be passed to partners. */ +@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; + + /* + * Company name of the user + */ + @JsonProperty(value = "companyName") + private String companyName; + + /* + * Email of the user used by Elastic for contacting them if needed + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * Company information of the user to be passed to partners. + */ + @JsonProperty(value = "companyInfo") + private CompanyInfo companyInfo; + + /** + * 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 companyName property: Company name of the user. + * + * @return the companyName value. + */ + public String companyName() { + return this.companyName; + } + + /** + * Set the companyName property: Company name of the user. + * + * @param companyName the companyName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get the emailAddress property: Email of the user used by Elastic 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 Elastic 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 companyInfo property: Company information of the user to be passed to partners. + * + * @return the companyInfo value. + */ + public CompanyInfo companyInfo() { + return this.companyInfo; + } + + /** + * Set the companyInfo property: Company information of the user to be passed to partners. + * + * @param companyInfo the companyInfo value to set. + * @return the UserInfo object itself. + */ + public UserInfo withCompanyInfo(CompanyInfo companyInfo) { + this.companyInfo = companyInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (companyInfo() != null) { + companyInfo().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/package-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/package-info.java new file mode 100644 index 0000000000000..93f4cb7b33b84 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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 MicrosoftElastic. null. */ +package com.azure.resourcemanager.elastic.models; diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/package-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/package-info.java new file mode 100644 index 0000000000000..699fe880b9ad1 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/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 MicrosoftElastic. null. */ +package com.azure.resourcemanager.elastic; diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/module-info.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/module-info.java new file mode 100644 index 0000000000000..daf249c3450bd --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/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.elastic { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.elastic; + exports com.azure.resourcemanager.elastic.fluent; + exports com.azure.resourcemanager.elastic.fluent.models; + exports com.azure.resourcemanager.elastic.models; + + opens com.azure.resourcemanager.elastic.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.elastic.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/elastic/ci.yml b/sdk/elastic/ci.yml new file mode 100644 index 0000000000000..670aa22d72e9e --- /dev/null +++ b/sdk/elastic/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/elastic/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elastic/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: elastic + Artifacts: + - name: azure-resourcemanager-elastic + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerelastic diff --git a/sdk/elastic/pom.xml b/sdk/elastic/pom.xml new file mode 100644 index 0000000000000..3dbf4babe1182 --- /dev/null +++ b/sdk/elastic/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-elastic-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-elastic + + + +