diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c264809e6f64..6476033202f1 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -191,6 +191,7 @@ com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/sdk/datadog/azure-resourcemanager-datadog/CHANGELOG.md b/sdk/datadog/azure-resourcemanager-datadog/CHANGELOG.md new file mode 100644 index 000000000000..70f12f996f0e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-08) + +- Azure Resource Manager MicrosoftDatadog client library for Java. This package contains Microsoft Azure SDK for MicrosoftDatadog Management SDK. Package tag package-2020-02-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/datadog/azure-resourcemanager-datadog/README.md b/sdk/datadog/azure-resourcemanager-datadog/README.md new file mode 100644 index 000000000000..f343624985da --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager MicrosoftDatadog client library for Java + +Azure Resource Manager MicrosoftDatadog client library for Java. + +This package contains Microsoft Azure SDK for MicrosoftDatadog Management SDK. Package tag package-2020-02-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## 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-datadog;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-datadog + 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(); +MicrosoftDatadogManager manager = MicrosoftDatadogManager + .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 + + +[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/datadog/azure-resourcemanager-datadog/pom.xml b/sdk/datadog/azure-resourcemanager-datadog/pom.xml new file mode 100644 index 000000000000..07f43c584759 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-datadog + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for MicrosoftDatadog Management + This package contains Microsoft Azure SDK for MicrosoftDatadog Management SDK. Package tag package-2020-02-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/MicrosoftDatadogManager.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/MicrosoftDatadogManager.java new file mode 100644 index 000000000000..ed710945ad8b --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/MicrosoftDatadogManager.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog; + +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.datadog.fluent.MicrosoftDatadogClient; +import com.azure.resourcemanager.datadog.implementation.ApiKeysImpl; +import com.azure.resourcemanager.datadog.implementation.HostsImpl; +import com.azure.resourcemanager.datadog.implementation.LinkedResourcesImpl; +import com.azure.resourcemanager.datadog.implementation.MarketplaceAgreementsImpl; +import com.azure.resourcemanager.datadog.implementation.MicrosoftDatadogClientBuilder; +import com.azure.resourcemanager.datadog.implementation.MonitoredResourcesImpl; +import com.azure.resourcemanager.datadog.implementation.MonitorsImpl; +import com.azure.resourcemanager.datadog.implementation.OperationsImpl; +import com.azure.resourcemanager.datadog.implementation.RefreshSetPasswordsImpl; +import com.azure.resourcemanager.datadog.implementation.SingleSignOnConfigurationsImpl; +import com.azure.resourcemanager.datadog.implementation.TagRulesImpl; +import com.azure.resourcemanager.datadog.models.ApiKeys; +import com.azure.resourcemanager.datadog.models.Hosts; +import com.azure.resourcemanager.datadog.models.LinkedResources; +import com.azure.resourcemanager.datadog.models.MarketplaceAgreements; +import com.azure.resourcemanager.datadog.models.MonitoredResources; +import com.azure.resourcemanager.datadog.models.Monitors; +import com.azure.resourcemanager.datadog.models.Operations; +import com.azure.resourcemanager.datadog.models.RefreshSetPasswords; +import com.azure.resourcemanager.datadog.models.SingleSignOnConfigurations; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogManager. */ +public final class MicrosoftDatadogManager { + private MarketplaceAgreements marketplaceAgreements; + + private ApiKeys apiKeys; + + private Hosts hosts; + + private LinkedResources linkedResources; + + private MonitoredResources monitoredResources; + + private Operations operations; + + private Monitors monitors; + + private RefreshSetPasswords refreshSetPasswords; + + private TagRules tagRules; + + private SingleSignOnConfigurations singleSignOnConfigurations; + + private final MicrosoftDatadogClient clientObject; + + private MicrosoftDatadogManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftDatadogClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of MicrosoftDatadog service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MicrosoftDatadog service API instance. + */ + public static MicrosoftDatadogManager 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 MicrosoftDatadogManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MicrosoftDatadogManager.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 MicrosoftDatadog service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MicrosoftDatadog service API instance. + */ + public MicrosoftDatadogManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.datadog", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + 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 MicrosoftDatadogManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of MarketplaceAgreements. */ + public MarketplaceAgreements marketplaceAgreements() { + if (this.marketplaceAgreements == null) { + this.marketplaceAgreements = new MarketplaceAgreementsImpl(clientObject.getMarketplaceAgreements(), this); + } + return marketplaceAgreements; + } + + /** @return Resource collection API of ApiKeys. */ + public ApiKeys apiKeys() { + if (this.apiKeys == null) { + this.apiKeys = new ApiKeysImpl(clientObject.getApiKeys(), this); + } + return apiKeys; + } + + /** @return Resource collection API of Hosts. */ + public Hosts hosts() { + if (this.hosts == null) { + this.hosts = new HostsImpl(clientObject.getHosts(), this); + } + return hosts; + } + + /** @return Resource collection API of LinkedResources. */ + public LinkedResources linkedResources() { + if (this.linkedResources == null) { + this.linkedResources = new LinkedResourcesImpl(clientObject.getLinkedResources(), this); + } + return linkedResources; + } + + /** @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 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 RefreshSetPasswords. */ + public RefreshSetPasswords refreshSetPasswords() { + if (this.refreshSetPasswords == null) { + this.refreshSetPasswords = new RefreshSetPasswordsImpl(clientObject.getRefreshSetPasswords(), this); + } + return refreshSetPasswords; + } + + /** @return Resource collection API of TagRules. */ + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + } + return tagRules; + } + + /** @return Resource collection API of SingleSignOnConfigurations. */ + public SingleSignOnConfigurations singleSignOnConfigurations() { + if (this.singleSignOnConfigurations == null) { + this.singleSignOnConfigurations = + new SingleSignOnConfigurationsImpl(clientObject.getSingleSignOnConfigurations(), this); + } + return singleSignOnConfigurations; + } + + /** + * @return Wrapped service client MicrosoftDatadogClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public MicrosoftDatadogClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/ApiKeysClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/ApiKeysClient.java new file mode 100644 index 000000000000..7db5ba4b103d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/ApiKeysClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; + +/** An instance of this class provides access to all the operations defined in ApiKeysClient. */ +public interface ApiKeysClient { + /** + * List the api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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); + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogApiKeyInner getDefaultKey(String resourceGroupName, String monitorName); + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultKeyWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 setDefaultKey(String resourceGroupName, String monitorName); + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response setDefaultKeyWithResponse( + String resourceGroupName, String monitorName, DatadogApiKeyInner body, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/HostsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/HostsClient.java new file mode 100644 index 000000000000..f3f00bcfb630 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/HostsClient.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.datadog.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.datadog.fluent.models.DatadogHostInner; + +/** An instance of this class provides access to all the operations defined in HostsClient. */ +public interface HostsClient { + /** + * List the hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/LinkedResourcesClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/LinkedResourcesClient.java new file mode 100644 index 000000000000..c5a6f14436c1 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/LinkedResourcesClient.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.datadog.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.datadog.fluent.models.LinkedResourceInner; + +/** An instance of this class provides access to all the operations defined in LinkedResourcesClient. */ +public interface LinkedResourcesClient { + /** + * List all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MarketplaceAgreementsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MarketplaceAgreementsClient.java new file mode 100644 index 000000000000..35ee9452ab41 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MarketplaceAgreementsClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; + +/** An instance of this class provides access to all the operations defined in MarketplaceAgreementsClient. */ +public interface MarketplaceAgreementsClient { + /** + * List Datadog marketplace agreements in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Datadog marketplace agreements in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogAgreementResourceInner create(); + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(DatadogAgreementResourceInner body, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MicrosoftDatadogClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MicrosoftDatadogClient.java new file mode 100644 index 000000000000..6d2e0e110376 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MicrosoftDatadogClient.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftDatadogClient class. */ +public interface MicrosoftDatadogClient { + /** + * Gets The Microsoft Azure subscription ID. + * + * @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 MarketplaceAgreementsClient object to access its operations. + * + * @return the MarketplaceAgreementsClient object. + */ + MarketplaceAgreementsClient getMarketplaceAgreements(); + + /** + * Gets the ApiKeysClient object to access its operations. + * + * @return the ApiKeysClient object. + */ + ApiKeysClient getApiKeys(); + + /** + * Gets the HostsClient object to access its operations. + * + * @return the HostsClient object. + */ + HostsClient getHosts(); + + /** + * Gets the LinkedResourcesClient object to access its operations. + * + * @return the LinkedResourcesClient object. + */ + LinkedResourcesClient getLinkedResources(); + + /** + * Gets the MonitoredResourcesClient object to access its operations. + * + * @return the MonitoredResourcesClient object. + */ + MonitoredResourcesClient getMonitoredResources(); + + /** + * 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 RefreshSetPasswordsClient object to access its operations. + * + * @return the RefreshSetPasswordsClient object. + */ + RefreshSetPasswordsClient getRefreshSetPasswords(); + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + TagRulesClient getTagRules(); + + /** + * Gets the SingleSignOnConfigurationsClient object to access its operations. + * + * @return the SingleSignOnConfigurationsClient object. + */ + SingleSignOnConfigurationsClient getSingleSignOnConfigurations(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MonitoredResourcesClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MonitoredResourcesClient.java new file mode 100644 index 000000000000..d97a96572ea0 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MonitorsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/MonitorsClient.java new file mode 100644 index 000000000000..d480fcdce89e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.fluent.models.DatadogMonitorResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResourceUpdateParameters; + +/** 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 Datadog 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 Datadog 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 Datadog 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) + DatadogMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatadogMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatadogMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body, Context context); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogMonitorResourceInner create(String resourceGroupName, String monitorName, DatadogMonitorResourceInner body); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogMonitorResourceInner create(String resourceGroupName, String monitorName); + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogMonitorResourceInner create( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body, Context context); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogMonitorResourceInner update(String resourceGroupName, String monitorName); + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, DatadogMonitorResourceUpdateParameters body, Context context); + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 Datadog 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 Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/OperationsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/OperationsClient.java new file mode 100644 index 000000000000..1e6286ea8093 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.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.Datadog for the 2020-02-01-preview api version. + * + * @throws com.azure.core.management.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.Datadog for the 2020-02-01-preview api version. + * + * @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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/RefreshSetPasswordsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/RefreshSetPasswordsClient.java new file mode 100644 index 000000000000..c0001dbbcc47 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/RefreshSetPasswordsClient.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.datadog.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.datadog.fluent.models.DatadogSetPasswordLinkInner; + +/** An instance of this class provides access to all the operations defined in RefreshSetPasswordsClient. */ +public interface RefreshSetPasswordsClient { + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogSetPasswordLinkInner get(String resourceGroupName, String monitorName); + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/SingleSignOnConfigurationsClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/SingleSignOnConfigurationsClient.java new file mode 100644 index 000000000000..49157b22cc87 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/SingleSignOnConfigurationsClient.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.fluent.models.DatadogSingleSignOnResourceInner; + +/** An instance of this class provides access to all the operations defined in SingleSignOnConfigurationsClient. */ +public interface SingleSignOnConfigurationsClient { + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatadogSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String configurationName, DatadogSingleSignOnResourceInner body); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatadogSingleSignOnResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName, DatadogSingleSignOnResourceInner body); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName); + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatadogSingleSignOnResourceInner get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/TagRulesClient.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/TagRulesClient.java new file mode 100644 index 000000000000..8fb32643f99e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/TagRulesClient.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.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 Datadog 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 Datadog 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set name. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context); + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogAgreementResourceInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogAgreementResourceInner.java new file mode 100644 index 000000000000..4eb5aefeb5c6 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogAgreementResourceInner.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.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.models.DatadogAgreementProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The DatadogAgreementResource model. */ +@Fluent +public final class DatadogAgreementResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogAgreementResourceInner.class); + + /* + * Represents the properties of the resource. + */ + @JsonProperty(value = "properties") + private DatadogAgreementProperties properties; + + /** + * Get the properties property: Represents the properties of the resource. + * + * @return the properties value. + */ + public DatadogAgreementProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Represents the properties of the resource. + * + * @param properties the properties value to set. + * @return the DatadogAgreementResourceInner object itself. + */ + public DatadogAgreementResourceInner withProperties(DatadogAgreementProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogApiKeyInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogApiKeyInner.java new file mode 100644 index 000000000000..be5bfea12dee --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogApiKeyInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.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 DatadogApiKey model. */ +@Fluent +public final class DatadogApiKeyInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogApiKeyInner.class); + + /* + * The user that created the API key. + */ + @JsonProperty(value = "createdBy") + private String createdBy; + + /* + * The name of the API key. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the API key. + */ + @JsonProperty(value = "key", required = true) + private String key; + + /* + * The time of creation of the API key. + */ + @JsonProperty(value = "created") + private String created; + + /** + * Get the createdBy property: The user that created the API key. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The user that created the API key. + * + * @param createdBy the createdBy value to set. + * @return the DatadogApiKeyInner object itself. + */ + public DatadogApiKeyInner withCreatedBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Get the name property: The name of the API key. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the API key. + * + * @param name the name value to set. + * @return the DatadogApiKeyInner object itself. + */ + public DatadogApiKeyInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the key property: The value of the API key. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The value of the API key. + * + * @param key the key value to set. + * @return the DatadogApiKeyInner object itself. + */ + public DatadogApiKeyInner withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the created property: The time of creation of the API key. + * + * @return the created value. + */ + public String created() { + return this.created; + } + + /** + * Set the created property: The time of creation of the API key. + * + * @param created the created value to set. + * @return the DatadogApiKeyInner object itself. + */ + public DatadogApiKeyInner withCreated(String created) { + this.created = created; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property key in model DatadogApiKeyInner")); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogHostInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogHostInner.java new file mode 100644 index 000000000000..4716b699cc4c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogHostInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.models.DatadogHostMetadata; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The DatadogHost model. */ +@Fluent +public final class DatadogHostInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogHostInner.class); + + /* + * The name of the host. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The aliases for the host. + */ + @JsonProperty(value = "aliases") + private List aliases; + + /* + * The Datadog integrations reporting metrics for the host. + */ + @JsonProperty(value = "apps") + private List apps; + + /* + * The meta property. + */ + @JsonProperty(value = "meta") + private DatadogHostMetadata meta; + + /** + * Get the name property: The name of the host. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the host. + * + * @param name the name value to set. + * @return the DatadogHostInner object itself. + */ + public DatadogHostInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the aliases property: The aliases for the host. + * + * @return the aliases value. + */ + public List aliases() { + return this.aliases; + } + + /** + * Set the aliases property: The aliases for the host. + * + * @param aliases the aliases value to set. + * @return the DatadogHostInner object itself. + */ + public DatadogHostInner withAliases(List aliases) { + this.aliases = aliases; + return this; + } + + /** + * Get the apps property: The Datadog integrations reporting metrics for the host. + * + * @return the apps value. + */ + public List apps() { + return this.apps; + } + + /** + * Set the apps property: The Datadog integrations reporting metrics for the host. + * + * @param apps the apps value to set. + * @return the DatadogHostInner object itself. + */ + public DatadogHostInner withApps(List apps) { + this.apps = apps; + return this; + } + + /** + * Get the meta property: The meta property. + * + * @return the meta value. + */ + public DatadogHostMetadata meta() { + return this.meta; + } + + /** + * Set the meta property: The meta property. + * + * @param meta the meta value to set. + * @return the DatadogHostInner object itself. + */ + public DatadogHostInner withMeta(DatadogHostMetadata meta) { + this.meta = meta; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (meta() != null) { + meta().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogMonitorResourceInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogMonitorResourceInner.java new file mode 100644 index 000000000000..b42b323a2cfb --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogMonitorResourceInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.models.IdentityProperties; +import com.azure.resourcemanager.datadog.models.MonitorProperties; +import com.azure.resourcemanager.datadog.models.ResourceSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The DatadogMonitorResource model. */ +@Fluent +public final class DatadogMonitorResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogMonitorResourceInner.class); + + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private ResourceSku sku; + + /* + * Properties specific to the monitor resource. + */ + @JsonProperty(value = "properties") + private MonitorProperties properties; + + /* + * The identity property. + */ + @JsonProperty(value = "identity") + private IdentityProperties identity; + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @param sku the sku value to set. + * @return the DatadogMonitorResourceInner object itself. + */ + public DatadogMonitorResourceInner withSku(ResourceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties specific to the monitor resource. + * + * @return the properties value. + */ + public MonitorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties specific to the monitor resource. + * + * @param properties the properties value to set. + * @return the DatadogMonitorResourceInner object itself. + */ + public DatadogMonitorResourceInner withProperties(MonitorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The identity property. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: The identity property. + * + * @param identity the identity value to set. + * @return the DatadogMonitorResourceInner object itself. + */ + public DatadogMonitorResourceInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatadogMonitorResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatadogMonitorResourceInner 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSetPasswordLinkInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSetPasswordLinkInner.java new file mode 100644 index 000000000000..5118e4d80bae --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSetPasswordLinkInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.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 DatadogSetPasswordLink model. */ +@Fluent +public final class DatadogSetPasswordLinkInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogSetPasswordLinkInner.class); + + /* + * The setPasswordLink property. + */ + @JsonProperty(value = "setPasswordLink") + private String setPasswordLink; + + /** + * Get the setPasswordLink property: The setPasswordLink property. + * + * @return the setPasswordLink value. + */ + public String setPasswordLink() { + return this.setPasswordLink; + } + + /** + * Set the setPasswordLink property: The setPasswordLink property. + * + * @param setPasswordLink the setPasswordLink value to set. + * @return the DatadogSetPasswordLinkInner object itself. + */ + public DatadogSetPasswordLinkInner withSetPasswordLink(String setPasswordLink) { + this.setPasswordLink = setPasswordLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSingleSignOnResourceInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSingleSignOnResourceInner.java new file mode 100644 index 000000000000..a3a58bc00d2c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/DatadogSingleSignOnResourceInner.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.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The DatadogSingleSignOnResource model. */ +@Fluent +public final class DatadogSingleSignOnResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogSingleSignOnResourceInner.class); + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private DatadogSingleSignOnProperties properties; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public DatadogSingleSignOnProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the DatadogSingleSignOnResourceInner object itself. + */ + public DatadogSingleSignOnResourceInner withProperties(DatadogSingleSignOnProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/LinkedResourceInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/LinkedResourceInner.java new file mode 100644 index 000000000000..ae48846edbcb --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/LinkedResourceInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.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 linked resource. */ +@Fluent +public final class LinkedResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedResourceInner.class); + + /* + * The ARM id of the linked resource. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: The ARM id of the linked resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM id of the linked resource. + * + * @param id the id value to set. + * @return the LinkedResourceInner object itself. + */ + public LinkedResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoredResourceInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoredResourceInner.java new file mode 100644 index 000000000000..a1ba8aa1858d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoredResourceInner.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.datadog.fluent.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 properties of a resource currently being monitored by the Datadog monitor resource. */ +@Fluent +public final class MonitoredResourceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitoredResourceInner.class); + + /* + * The ARM id of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Flag indicating if resource is sending metrics to Datadog. + */ + @JsonProperty(value = "sendingMetrics") + private Boolean sendingMetrics; + + /* + * Reason for why the resource is sending metrics (or why it is not + * sending). + */ + @JsonProperty(value = "reasonForMetricsStatus") + private String reasonForMetricsStatus; + + /* + * Flag indicating if resource is sending logs to Datadog. + */ + @JsonProperty(value = "sendingLogs") + private Boolean 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 sendingMetrics property: Flag indicating if resource is sending metrics to Datadog. + * + * @return the sendingMetrics value. + */ + public Boolean sendingMetrics() { + return this.sendingMetrics; + } + + /** + * Set the sendingMetrics property: Flag indicating if resource is sending metrics to Datadog. + * + * @param sendingMetrics the sendingMetrics value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingMetrics(Boolean sendingMetrics) { + this.sendingMetrics = sendingMetrics; + return this; + } + + /** + * Get the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + public String reasonForMetricsStatus() { + return this.reasonForMetricsStatus; + } + + /** + * Set the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @param reasonForMetricsStatus the reasonForMetricsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForMetricsStatus(String reasonForMetricsStatus) { + this.reasonForMetricsStatus = reasonForMetricsStatus; + return this; + } + + /** + * Get the sendingLogs property: Flag indicating if resource is sending logs to Datadog. + * + * @return the sendingLogs value. + */ + public Boolean sendingLogs() { + return this.sendingLogs; + } + + /** + * Set the sendingLogs property: Flag indicating if resource is sending logs to Datadog. + * + * @param sendingLogs the sendingLogs value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingLogs(Boolean 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoringTagRulesInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoringTagRulesInner.java new file mode 100644 index 000000000000..37974a644fef --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/MonitoringTagRulesInner.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.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.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); + + /* + * Definition of the properties for a TagRules resource. + */ + @JsonProperty(value = "properties") + private MonitoringTagRulesProperties properties; + + /** + * Get the properties property: Definition of the properties for a TagRules resource. + * + * @return the properties value. + */ + public MonitoringTagRulesProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Definition of the properties for a TagRules resource. + * + * @param properties the properties value to set. + * @return the MonitoringTagRulesInner object itself. + */ + public MonitoringTagRulesInner withProperties(MonitoringTagRulesProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/OperationResultInner.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/OperationResultInner.java new file mode 100644 index 000000000000..e6102965aeb4 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/OperationResultInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A Microsoft.Datadog 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; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /** + * 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 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 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/package-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/models/package-info.java new file mode 100644 index 000000000000..c35ae039fb6d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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 MicrosoftDatadogClient. null. */ +package com.azure.resourcemanager.datadog.fluent.models; diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/package-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/fluent/package-info.java new file mode 100644 index 000000000000..2dbed393cf6a --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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 MicrosoftDatadogClient. null. */ +package com.azure.resourcemanager.datadog.fluent; diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysClientImpl.java new file mode 100644 index 000000000000..81215e5de520 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysClientImpl.java @@ -0,0 +1,686 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.datadog.fluent.ApiKeysClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; +import com.azure.resourcemanager.datadog.models.DatadogApiKeyListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApiKeysClient. */ +public final class ApiKeysClientImpl implements ApiKeysClient { + private final ClientLogger logger = new ClientLogger(ApiKeysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApiKeysService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of ApiKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApiKeysClientImpl(MicrosoftDatadogClientImpl client) { + this.service = RestProxy.create(ApiKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientApiKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface ApiKeysService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/listApiKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/getDefaultKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/setDefaultKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> setDefaultKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatadogApiKeyInner body, + @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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultKeyWithResponseAsync( + 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 + .getDefaultKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultKeyWithResponseAsync( + 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 + .getDefaultKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultKeyAsync(String resourceGroupName, String monitorName) { + return getDefaultKeyWithResponseAsync(resourceGroupName, monitorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogApiKeyInner getDefaultKey(String resourceGroupName, String monitorName) { + return getDefaultKeyAsync(resourceGroupName, monitorName).block(); + } + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultKeyWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getDefaultKeyWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> setDefaultKeyWithResponseAsync( + String resourceGroupName, String monitorName, DatadogApiKeyInner 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 + .setDefaultKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> setDefaultKeyWithResponseAsync( + String resourceGroupName, String monitorName, DatadogApiKeyInner 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 + .setDefaultKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono setDefaultKeyAsync(String resourceGroupName, String monitorName, DatadogApiKeyInner body) { + return setDefaultKeyWithResponseAsync(resourceGroupName, monitorName, body) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 setDefaultKeyAsync(String resourceGroupName, String monitorName) { + final DatadogApiKeyInner body = null; + return setDefaultKeyWithResponseAsync(resourceGroupName, monitorName, body) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 setDefaultKey(String resourceGroupName, String monitorName) { + final DatadogApiKeyInner body = null; + setDefaultKeyAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setDefaultKeyWithResponse( + String resourceGroupName, String monitorName, DatadogApiKeyInner body, Context context) { + return setDefaultKeyWithResponseAsync(resourceGroupName, monitorName, body, 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysImpl.java new file mode 100644 index 000000000000..f0db23db00ab --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/ApiKeysImpl.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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.ApiKeysClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; +import com.azure.resourcemanager.datadog.models.ApiKeys; +import com.azure.resourcemanager.datadog.models.DatadogApiKey; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApiKeysImpl implements ApiKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiKeysImpl.class); + + private final ApiKeysClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public ApiKeysImpl(ApiKeysClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new DatadogApiKeyImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(inner1 -> new DatadogApiKeyImpl(inner1, this.manager())); + } + + public DatadogApiKey getDefaultKey(String resourceGroupName, String monitorName) { + DatadogApiKeyInner inner = this.serviceClient().getDefaultKey(resourceGroupName, monitorName); + if (inner != null) { + return new DatadogApiKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultKeyWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().getDefaultKeyWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatadogApiKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void setDefaultKey(String resourceGroupName, String monitorName) { + this.serviceClient().setDefaultKey(resourceGroupName, monitorName); + } + + public Response setDefaultKeyWithResponse( + String resourceGroupName, String monitorName, DatadogApiKeyInner body, Context context) { + return this.serviceClient().setDefaultKeyWithResponse(resourceGroupName, monitorName, body, context); + } + + private ApiKeysClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogAgreementResourceImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogAgreementResourceImpl.java new file mode 100644 index 000000000000..faabad8af840 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogAgreementResourceImpl.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.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogAgreementProperties; +import com.azure.resourcemanager.datadog.models.DatadogAgreementResource; + +public final class DatadogAgreementResourceImpl implements DatadogAgreementResource { + private DatadogAgreementResourceInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + DatadogAgreementResourceImpl(DatadogAgreementResourceInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DatadogAgreementProperties properties() { + return this.innerModel().properties(); + } + + public DatadogAgreementResourceInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogApiKeyImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogApiKeyImpl.java new file mode 100644 index 000000000000..5e1ddbe27355 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogApiKeyImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; +import com.azure.resourcemanager.datadog.models.DatadogApiKey; + +public final class DatadogApiKeyImpl implements DatadogApiKey { + private DatadogApiKeyInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + DatadogApiKeyImpl(DatadogApiKeyInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String createdBy() { + return this.innerModel().createdBy(); + } + + public String name() { + return this.innerModel().name(); + } + + public String key() { + return this.innerModel().key(); + } + + public String created() { + return this.innerModel().created(); + } + + public DatadogApiKeyInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogHostImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogHostImpl.java new file mode 100644 index 000000000000..303884151dd2 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogHostImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner; +import com.azure.resourcemanager.datadog.models.DatadogHost; +import com.azure.resourcemanager.datadog.models.DatadogHostMetadata; +import java.util.Collections; +import java.util.List; + +public final class DatadogHostImpl implements DatadogHost { + private DatadogHostInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + DatadogHostImpl(DatadogHostInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public List aliases() { + List inner = this.innerModel().aliases(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List apps() { + List inner = this.innerModel().apps(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DatadogHostMetadata meta() { + return this.innerModel().meta(); + } + + public DatadogHostInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogMonitorResourceImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogMonitorResourceImpl.java new file mode 100644 index 000000000000..da15d3481dc7 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogMonitorResourceImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResource; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResourceUpdateParameters; +import com.azure.resourcemanager.datadog.models.IdentityProperties; +import com.azure.resourcemanager.datadog.models.MonitorProperties; +import com.azure.resourcemanager.datadog.models.MonitorUpdateProperties; +import com.azure.resourcemanager.datadog.models.ResourceSku; +import java.util.Collections; +import java.util.Map; + +public final class DatadogMonitorResourceImpl + implements DatadogMonitorResource, DatadogMonitorResource.Definition, DatadogMonitorResource.Update { + private DatadogMonitorResourceInner innerObject; + + private final MicrosoftDatadogManager 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatadogMonitorResourceInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private DatadogMonitorResourceUpdateParameters updateBody; + + public DatadogMonitorResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DatadogMonitorResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public DatadogMonitorResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .create(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + DatadogMonitorResourceImpl(String name, MicrosoftDatadogManager serviceManager) { + this.innerObject = new DatadogMonitorResourceInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public DatadogMonitorResourceImpl update() { + this.updateBody = new DatadogMonitorResourceUpdateParameters(); + return this; + } + + public DatadogMonitorResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public DatadogMonitorResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateBody, context) + .getValue(); + return this; + } + + DatadogMonitorResourceImpl(DatadogMonitorResourceInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public DatadogMonitorResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public DatadogMonitorResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public DatadogMonitorResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DatadogMonitorResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DatadogMonitorResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DatadogMonitorResourceImpl withSku(ResourceSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public DatadogMonitorResourceImpl withProperties(MonitorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public DatadogMonitorResourceImpl withIdentity(IdentityProperties identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public DatadogMonitorResourceImpl withProperties(MonitorUpdateProperties properties) { + this.updateBody.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSetPasswordLinkImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSetPasswordLinkImpl.java new file mode 100644 index 000000000000..f4c2a46ce296 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSetPasswordLinkImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSetPasswordLinkInner; +import com.azure.resourcemanager.datadog.models.DatadogSetPasswordLink; + +public final class DatadogSetPasswordLinkImpl implements DatadogSetPasswordLink { + private DatadogSetPasswordLinkInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + DatadogSetPasswordLinkImpl(DatadogSetPasswordLinkInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String setPasswordLink() { + return this.innerModel().setPasswordLink(); + } + + public DatadogSetPasswordLinkInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSingleSignOnResourceImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSingleSignOnResourceImpl.java new file mode 100644 index 000000000000..66621eff203f --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/DatadogSingleSignOnResourceImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnProperties; +import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnResource; + +public final class DatadogSingleSignOnResourceImpl + implements DatadogSingleSignOnResource, DatadogSingleSignOnResource.Definition, DatadogSingleSignOnResource.Update { + private DatadogSingleSignOnResourceInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DatadogSingleSignOnProperties properties() { + return this.innerModel().properties(); + } + + public DatadogSingleSignOnResourceInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String configurationName; + + public DatadogSingleSignOnResourceImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public DatadogSingleSignOnResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public DatadogSingleSignOnResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + DatadogSingleSignOnResourceImpl(String name, MicrosoftDatadogManager serviceManager) { + this.innerObject = new DatadogSingleSignOnResourceInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public DatadogSingleSignOnResourceImpl update() { + return this; + } + + public DatadogSingleSignOnResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public DatadogSingleSignOnResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .createOrUpdate(resourceGroupName, monitorName, configurationName, this.innerModel(), context); + return this; + } + + DatadogSingleSignOnResourceImpl( + DatadogSingleSignOnResourceInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "singleSignOnConfigurations"); + } + + public DatadogSingleSignOnResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public DatadogSingleSignOnResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSingleSignOnConfigurations() + .getWithResponse(resourceGroupName, monitorName, configurationName, context) + .getValue(); + return this; + } + + public DatadogSingleSignOnResourceImpl withProperties(DatadogSingleSignOnProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsClientImpl.java new file mode 100644 index 000000000000..2cf89bfb13f8 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsClientImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.fluent.HostsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner; +import com.azure.resourcemanager.datadog.models.DatadogHostListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HostsClient. */ +public final class HostsClientImpl implements HostsClient { + private final ClientLogger logger = new ClientLogger(HostsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final HostsService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of HostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HostsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = RestProxy.create(HostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientHosts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface HostsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/listHosts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsImpl.java new file mode 100644 index 000000000000..c1fdb59cbeb9 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/HostsImpl.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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.HostsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner; +import com.azure.resourcemanager.datadog.models.DatadogHost; +import com.azure.resourcemanager.datadog.models.Hosts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class HostsImpl implements Hosts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HostsImpl.class); + + private final HostsClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public HostsImpl(HostsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new DatadogHostImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(inner1 -> new DatadogHostImpl(inner1, this.manager())); + } + + private HostsClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourceImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourceImpl.java new file mode 100644 index 000000000000..c34f2325ba35 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourceImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner; +import com.azure.resourcemanager.datadog.models.LinkedResource; + +public final class LinkedResourceImpl implements LinkedResource { + private LinkedResourceInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + LinkedResourceImpl(LinkedResourceInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public LinkedResourceInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesClientImpl.java new file mode 100644 index 000000000000..b5f9a6997371 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.fluent.LinkedResourcesClient; +import com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner; +import com.azure.resourcemanager.datadog.models.LinkedResourceListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LinkedResourcesClient. */ +public final class LinkedResourcesClientImpl implements LinkedResourcesClient { + private final ClientLogger logger = new ClientLogger(LinkedResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LinkedResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of LinkedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LinkedResourcesClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy.create(LinkedResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientLinkedResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface LinkedResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/listLinkedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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 Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesImpl.java new file mode 100644 index 000000000000..f4ad82283491 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/LinkedResourcesImpl.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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.LinkedResourcesClient; +import com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner; +import com.azure.resourcemanager.datadog.models.LinkedResource; +import com.azure.resourcemanager.datadog.models.LinkedResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LinkedResourcesImpl implements LinkedResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedResourcesImpl.class); + + private final LinkedResourcesClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public LinkedResourcesImpl(LinkedResourcesClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new LinkedResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(inner1 -> new LinkedResourceImpl(inner1, this.manager())); + } + + private LinkedResourcesClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsClientImpl.java new file mode 100644 index 000000000000..542a00f564e3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsClientImpl.java @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.MarketplaceAgreementsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogAgreementResourceListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MarketplaceAgreementsClient. */ +public final class MarketplaceAgreementsClientImpl implements MarketplaceAgreementsClient { + private final ClientLogger logger = new ClientLogger(MarketplaceAgreementsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MarketplaceAgreementsService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of MarketplaceAgreementsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MarketplaceAgreementsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy + .create(MarketplaceAgreementsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientMarketplaceAgreements to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface MarketplaceAgreementsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatadogAgreementResourceInner body, + @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 Datadog marketplace agreements in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List Datadog marketplace agreements in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Datadog marketplace agreements in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List Datadog marketplace agreements in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List Datadog marketplace agreements in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Datadog marketplace agreements in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(DatadogAgreementResourceInner 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 (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + DatadogAgreementResourceInner 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 (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(DatadogAgreementResourceInner body) { + return createWithResponseAsync(body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync() { + final DatadogAgreementResourceInner body = null; + return createWithResponseAsync(body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogAgreementResourceInner create() { + final DatadogAgreementResourceInner body = null; + return createAsync(body).block(); + } + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + DatadogAgreementResourceInner body, Context context) { + return createWithResponseAsync(body, 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsImpl.java new file mode 100644 index 000000000000..9cf09d806ebb --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MarketplaceAgreementsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.MarketplaceAgreementsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogAgreementResource; +import com.azure.resourcemanager.datadog.models.MarketplaceAgreements; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MarketplaceAgreementsImpl implements MarketplaceAgreements { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceAgreementsImpl.class); + + private final MarketplaceAgreementsClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public MarketplaceAgreementsImpl(MarketplaceAgreementsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new DatadogAgreementResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new DatadogAgreementResourceImpl(inner1, this.manager())); + } + + public DatadogAgreementResource create() { + DatadogAgreementResourceInner inner = this.serviceClient().create(); + if (inner != null) { + return new DatadogAgreementResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createWithResponse(DatadogAgreementResourceInner body, Context context) { + Response inner = this.serviceClient().createWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatadogAgreementResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private MarketplaceAgreementsClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientBuilder.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientBuilder.java new file mode 100644 index 000000000000..aa24686618d5 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientBuilder.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.datadog.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 MicrosoftDatadogClientImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftDatadogClientImpl.class}) +public final class MicrosoftDatadogClientBuilder { + /* + * The Microsoft Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets The Microsoft Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder 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 MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder 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 MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder 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 MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder 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 MicrosoftDatadogClientBuilder. + */ + public MicrosoftDatadogClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftDatadogClientImpl with the provided parameters. + * + * @return an instance of MicrosoftDatadogClientImpl. + */ + public MicrosoftDatadogClientImpl 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(); + } + MicrosoftDatadogClientImpl client = + new MicrosoftDatadogClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientImpl.java new file mode 100644 index 000000000000..6162b6369e00 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientImpl.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.fluent.ApiKeysClient; +import com.azure.resourcemanager.datadog.fluent.HostsClient; +import com.azure.resourcemanager.datadog.fluent.LinkedResourcesClient; +import com.azure.resourcemanager.datadog.fluent.MarketplaceAgreementsClient; +import com.azure.resourcemanager.datadog.fluent.MicrosoftDatadogClient; +import com.azure.resourcemanager.datadog.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.datadog.fluent.MonitorsClient; +import com.azure.resourcemanager.datadog.fluent.OperationsClient; +import com.azure.resourcemanager.datadog.fluent.RefreshSetPasswordsClient; +import com.azure.resourcemanager.datadog.fluent.SingleSignOnConfigurationsClient; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogClientImpl type. */ +@ServiceClient(builder = MicrosoftDatadogClientBuilder.class) +public final class MicrosoftDatadogClientImpl implements MicrosoftDatadogClient { + private final ClientLogger logger = new ClientLogger(MicrosoftDatadogClientImpl.class); + + /** The Microsoft Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets The Microsoft Azure subscription ID. + * + * @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 MarketplaceAgreementsClient object to access its operations. */ + private final MarketplaceAgreementsClient marketplaceAgreements; + + /** + * Gets the MarketplaceAgreementsClient object to access its operations. + * + * @return the MarketplaceAgreementsClient object. + */ + public MarketplaceAgreementsClient getMarketplaceAgreements() { + return this.marketplaceAgreements; + } + + /** The ApiKeysClient object to access its operations. */ + private final ApiKeysClient apiKeys; + + /** + * Gets the ApiKeysClient object to access its operations. + * + * @return the ApiKeysClient object. + */ + public ApiKeysClient getApiKeys() { + return this.apiKeys; + } + + /** The HostsClient object to access its operations. */ + private final HostsClient hosts; + + /** + * Gets the HostsClient object to access its operations. + * + * @return the HostsClient object. + */ + public HostsClient getHosts() { + return this.hosts; + } + + /** The LinkedResourcesClient object to access its operations. */ + private final LinkedResourcesClient linkedResources; + + /** + * Gets the LinkedResourcesClient object to access its operations. + * + * @return the LinkedResourcesClient object. + */ + public LinkedResourcesClient getLinkedResources() { + return this.linkedResources; + } + + /** 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 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 RefreshSetPasswordsClient object to access its operations. */ + private final RefreshSetPasswordsClient refreshSetPasswords; + + /** + * Gets the RefreshSetPasswordsClient object to access its operations. + * + * @return the RefreshSetPasswordsClient object. + */ + public RefreshSetPasswordsClient getRefreshSetPasswords() { + return this.refreshSetPasswords; + } + + /** The TagRulesClient object to access its operations. */ + private final TagRulesClient tagRules; + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + public TagRulesClient getTagRules() { + return this.tagRules; + } + + /** The SingleSignOnConfigurationsClient object to access its operations. */ + private final SingleSignOnConfigurationsClient singleSignOnConfigurations; + + /** + * Gets the SingleSignOnConfigurationsClient object to access its operations. + * + * @return the SingleSignOnConfigurationsClient object. + */ + public SingleSignOnConfigurationsClient getSingleSignOnConfigurations() { + return this.singleSignOnConfigurations; + } + + /** + * Initializes an instance of MicrosoftDatadogClient 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 Microsoft Azure subscription ID. + * @param endpoint server parameter. + */ + MicrosoftDatadogClientImpl( + 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-02-01-preview"; + this.marketplaceAgreements = new MarketplaceAgreementsClientImpl(this); + this.apiKeys = new ApiKeysClientImpl(this); + this.hosts = new HostsClientImpl(this); + this.linkedResources = new LinkedResourcesClientImpl(this); + this.monitoredResources = new MonitoredResourcesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.refreshSetPasswords = new RefreshSetPasswordsClientImpl(this); + this.tagRules = new TagRulesClientImpl(this); + this.singleSignOnConfigurations = new SingleSignOnConfigurationsClientImpl(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 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.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourceImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourceImpl.java new file mode 100644 index 000000000000..4a5c8e98b953 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourceImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.datadog.models.MonitoredResource; + +public final class MonitoredResourceImpl implements MonitoredResource { + private MonitoredResourceInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + MonitoredResourceImpl(MonitoredResourceInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Boolean sendingMetrics() { + return this.innerModel().sendingMetrics(); + } + + public String reasonForMetricsStatus() { + return this.innerModel().reasonForMetricsStatus(); + } + + public Boolean sendingLogs() { + return this.innerModel().sendingLogs(); + } + + public String reasonForLogsStatus() { + return this.innerModel().reasonForLogsStatus(); + } + + public MonitoredResourceInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourcesClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourcesClientImpl.java new file mode 100644 index 000000000000..416cab76fc3a --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.datadog.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of MonitoredResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitoredResourcesClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy.create(MonitoredResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientMonitoredResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface MonitoredResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/listMonitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the resources currently being monitored by the Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the resources currently being monitored by the Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourcesImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoredResourcesImpl.java new file mode 100644 index 000000000000..9cebfc4d2a7b --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.MonitoredResourcesClient; +import com.azure.resourcemanager.datadog.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.datadog.models.MonitoredResource; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogManager serviceManager; + + public MonitoredResourcesImpl(MonitoredResourcesClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + private MonitoredResourcesClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoringTagRulesImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoringTagRulesImpl.java new file mode 100644 index 000000000000..cb356b6577b3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitoringTagRulesImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.datadog.models.MonitoringTagRules; +import com.azure.resourcemanager.datadog.models.MonitoringTagRulesProperties; + +public final class MonitoringTagRulesImpl + implements MonitoringTagRules, MonitoringTagRules.Definition, MonitoringTagRules.Update { + private MonitoringTagRulesInner innerObject; + + private final MicrosoftDatadogManager 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 MonitoringTagRulesInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager 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, MicrosoftDatadogManager 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, MicrosoftDatadogManager 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitorsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitorsClientImpl.java new file mode 100644 index 000000000000..8d6be343c71a --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.fluent.MonitorsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResourceListResponse; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResourceUpdateParameters; +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 MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientMonitors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatadogMonitorResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatadogMonitorResourceUpdateParameters body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> 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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all monitors under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all monitors under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> 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 Datadog 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all monitors under the specified resource group. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 DatadogMonitorResourceInner 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 Datadog 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatadogMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatadogMonitorResourceInner.class, + DatadogMonitorResourceInner.class, + Context.NONE); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatadogMonitorResourceInner> beginCreateAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, monitorName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatadogMonitorResourceInner.class, + DatadogMonitorResourceInner.class, + context); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatadogMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body) { + return beginCreateAsync(resourceGroupName, monitorName, body).getSyncPoller(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatadogMonitorResourceInner> beginCreate( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner 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 Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String monitorName) { + final DatadogMonitorResourceInner 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogMonitorResourceInner create( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner body) { + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogMonitorResourceInner create(String resourceGroupName, String monitorName) { + final DatadogMonitorResourceInner body = null; + return createAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Create a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogMonitorResourceInner create( + String resourceGroupName, String monitorName, DatadogMonitorResourceInner 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceUpdateParameters body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceUpdateParameters body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, DatadogMonitorResourceUpdateParameters 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 Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String monitorName) { + final DatadogMonitorResourceUpdateParameters 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 Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogMonitorResourceInner update(String resourceGroupName, String monitorName) { + final DatadogMonitorResourceUpdateParameters body = null; + return updateAsync(resourceGroupName, monitorName, body).block(); + } + + /** + * Update a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The parameters for a PATCH request to a monitor resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, DatadogMonitorResourceUpdateParameters 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 Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitorsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitorsImpl.java new file mode 100644 index 000000000000..b1e3fe47d80a --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MonitorsImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.MonitorsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogMonitorResource; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogManager serviceManager; + + public MonitorsImpl(MonitorsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new DatadogMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new DatadogMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new DatadogMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new DatadogMonitorResourceImpl(inner1, this.manager())); + } + + public DatadogMonitorResource getByResourceGroup(String resourceGroupName, String monitorName) { + DatadogMonitorResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new DatadogMonitorResourceImpl(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 DatadogMonitorResourceImpl(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 DatadogMonitorResource 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 MicrosoftDatadogManager manager() { + return this.serviceManager; + } + + public DatadogMonitorResourceImpl define(String name) { + return new DatadogMonitorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationResultImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationResultImpl.java new file mode 100644 index 000000000000..cf27b7f683ec --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationResultImpl.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.datadog.implementation; + +import com.azure.resourcemanager.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.models.OperationResultInner; +import com.azure.resourcemanager.datadog.models.OperationDisplay; +import com.azure.resourcemanager.datadog.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final MicrosoftDatadogManager serviceManager; + + OperationResultImpl(OperationResultInner innerObject, MicrosoftDatadogManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..f649ccb93c7d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.fluent.OperationsClient; +import com.azure.resourcemanager.datadog.fluent.models.OperationResultInner; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Datadog/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.Datadog for the 2020-02-01-preview api version. + * + * @throws 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.Datadog for the 2020-02-01-preview api version. + * + * @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.Datadog for the 2020-02-01-preview api version. + * + * @throws 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.Datadog for the 2020-02-01-preview api version. + * + * @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.Datadog for the 2020-02-01-preview api version. + * + * @throws 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.Datadog for the 2020-02-01-preview api version. + * + * @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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/OperationsImpl.java new file mode 100644 index 000000000000..82f38b480781 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.OperationsClient; +import com.azure.resourcemanager.datadog.fluent.models.OperationResultInner; +import com.azure.resourcemanager.datadog.models.OperationResult; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsClientImpl.java new file mode 100644 index 000000000000..0b358b1b6273 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsClientImpl.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.datadog.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.datadog.fluent.RefreshSetPasswordsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSetPasswordLinkInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RefreshSetPasswordsClient. */ +public final class RefreshSetPasswordsClientImpl implements RefreshSetPasswordsClient { + private final ClientLogger logger = new ClientLogger(RefreshSetPasswordsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RefreshSetPasswordsService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of RefreshSetPasswordsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RefreshSetPasswordsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy.create(RefreshSetPasswordsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientRefreshSetPasswords to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface RefreshSetPasswordsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/refreshSetPasswordLink") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String monitorName) { + return getWithResponseAsync(resourceGroupName, monitorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogSetPasswordLinkInner get(String resourceGroupName, String monitorName) { + return getAsync(resourceGroupName, monitorName).block(); + } + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, context).block(); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsImpl.java new file mode 100644 index 000000000000..ce63197f9d11 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/RefreshSetPasswordsImpl.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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.RefreshSetPasswordsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSetPasswordLinkInner; +import com.azure.resourcemanager.datadog.models.DatadogSetPasswordLink; +import com.azure.resourcemanager.datadog.models.RefreshSetPasswords; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RefreshSetPasswordsImpl implements RefreshSetPasswords { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RefreshSetPasswordsImpl.class); + + private final RefreshSetPasswordsClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public RefreshSetPasswordsImpl(RefreshSetPasswordsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DatadogSetPasswordLink get(String resourceGroupName, String monitorName) { + DatadogSetPasswordLinkInner inner = this.serviceClient().get(resourceGroupName, monitorName); + if (inner != null) { + return new DatadogSetPasswordLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatadogSetPasswordLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RefreshSetPasswordsClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsClientImpl.java new file mode 100644 index 000000000000..7bd8970bfdee --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsClientImpl.java @@ -0,0 +1,902 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.datadog.fluent.SingleSignOnConfigurationsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnResourceListResponse; +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 SingleSignOnConfigurationsClient. */ +public final class SingleSignOnConfigurationsClientImpl implements SingleSignOnConfigurationsClient { + private final ClientLogger logger = new ClientLogger(SingleSignOnConfigurationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SingleSignOnConfigurationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of SingleSignOnConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SingleSignOnConfigurationsClientImpl(MicrosoftDatadogClientImpl client) { + this.service = + RestProxy + .create( + SingleSignOnConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientSingleSignOnConfigurations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface SingleSignOnConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/singleSignOnConfigurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/singleSignOnConfigurations/{configurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatadogSingleSignOnResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/singleSignOnConfigurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("configurationName") String configurationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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)); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName, DatadogSingleSignOnResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatadogSingleSignOnResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, configurationName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatadogSingleSignOnResourceInner.class, + DatadogSingleSignOnResourceInner.class, + Context.NONE); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatadogSingleSignOnResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, configurationName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatadogSingleSignOnResourceInner.class, + DatadogSingleSignOnResourceInner.class, + context); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatadogSingleSignOnResourceInner> + beginCreateOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).getSyncPoller(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatadogSingleSignOnResourceInner> + beginCreateOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context) + .getSyncPoller(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String configurationName, DatadogSingleSignOnResourceInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String configurationName) { + final DatadogSingleSignOnResourceInner body = null; + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName, DatadogSingleSignOnResourceInner body) { + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).block(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, String monitorName, String configurationName) { + final DatadogSingleSignOnResourceInner body = null; + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body).block(); + } + + /** + * Configures single-sign-on for this resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogSingleSignOnResourceInner createOrUpdate( + String resourceGroupName, + String monitorName, + String configurationName, + DatadogSingleSignOnResourceInner body, + Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, configurationName, body, context).block(); + } + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String configurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + configurationName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String monitorName, String configurationName) { + return getWithResponseAsync(resourceGroupName, monitorName, configurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatadogSingleSignOnResourceInner get( + String resourceGroupName, String monitorName, String configurationName) { + return getAsync(resourceGroupName, monitorName, configurationName).block(); + } + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, configurationName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsImpl.java new file mode 100644 index 000000000000..536c685880f3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/SingleSignOnConfigurationsImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.SingleSignOnConfigurationsClient; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner; +import com.azure.resourcemanager.datadog.models.DatadogSingleSignOnResource; +import com.azure.resourcemanager.datadog.models.SingleSignOnConfigurations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SingleSignOnConfigurationsImpl implements SingleSignOnConfigurations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SingleSignOnConfigurationsImpl.class); + + private final SingleSignOnConfigurationsClient innerClient; + + private final MicrosoftDatadogManager serviceManager; + + public SingleSignOnConfigurationsImpl( + SingleSignOnConfigurationsClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new DatadogSingleSignOnResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(inner1 -> new DatadogSingleSignOnResourceImpl(inner1, this.manager())); + } + + public DatadogSingleSignOnResource get(String resourceGroupName, String monitorName, String configurationName) { + DatadogSingleSignOnResourceInner inner = + this.serviceClient().get(resourceGroupName, monitorName, configurationName); + if (inner != null) { + return new DatadogSingleSignOnResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatadogSingleSignOnResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatadogSingleSignOnResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "singleSignOnConfigurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", + id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "singleSignOnConfigurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'singleSignOnConfigurations'.", + id))); + } + return this.getWithResponse(resourceGroupName, monitorName, configurationName, context); + } + + private SingleSignOnConfigurationsClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } + + public DatadogSingleSignOnResourceImpl define(String name) { + return new DatadogSingleSignOnResourceImpl(name, this.manager()); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesClientImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesClientImpl.java new file mode 100644 index 000000000000..98ea5e8c41d5 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesClientImpl.java @@ -0,0 +1,742 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.TagRulesClient; +import com.azure.resourcemanager.datadog.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.datadog.models.MonitoringTagRulesListResponse; +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 MicrosoftDatadogClientImpl client; + + /** + * Initializes an instance of TagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagRulesClientImpl(MicrosoftDatadogClientImpl client) { + this.service = RestProxy.create(TagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftDatadogClientTagRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftDatadogClie") + private interface TagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MonitoringTagRulesInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors" + + "/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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 Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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.getSubscriptionId(), + resourceGroupName, + monitorName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the tag rules for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 Datadog 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 Datadog 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set name. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, MonitoringTagRulesInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set name. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set name. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, MonitoringTagRulesInner body) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set name. + * @param body Capture logs and metrics of Azure resources based on ARM tags. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return capture logs and metrics of Azure resources based on ARM tags. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + MonitoringTagRulesInner body, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, body, context).block(); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a tag rule set for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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(); + } + + /** + * 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesImpl.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesImpl.java new file mode 100644 index 000000000000..a31503eff786 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/TagRulesImpl.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.datadog.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.datadog.MicrosoftDatadogManager; +import com.azure.resourcemanager.datadog.fluent.TagRulesClient; +import com.azure.resourcemanager.datadog.fluent.models.MonitoringTagRulesInner; +import com.azure.resourcemanager.datadog.models.MonitoringTagRules; +import com.azure.resourcemanager.datadog.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 MicrosoftDatadogManager serviceManager; + + public TagRulesImpl(TagRulesClient innerClient, MicrosoftDatadogManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String monitorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, monitorName); + return inner.mapPage(inner1 -> new MonitoringTagRulesImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, monitorName, context); + return inner.mapPage(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 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); + } + + private TagRulesClient serviceClient() { + return this.innerClient; + } + + private MicrosoftDatadogManager manager() { + return this.serviceManager; + } + + public MonitoringTagRulesImpl define(String name) { + return new MonitoringTagRulesImpl(name, this.manager()); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/Utils.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/Utils.java new file mode 100644 index 000000000000..e2531125c4ea --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.implementation; + +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; + +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; + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/package-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/package-info.java new file mode 100644 index 000000000000..d23f8fa4de48 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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 MicrosoftDatadogClient. null. */ +package com.azure.resourcemanager.datadog.implementation; diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ApiKeys.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ApiKeys.java new file mode 100644 index 000000000000..876cb466a402 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ApiKeys.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; + +/** Resource collection API of ApiKeys. */ +public interface ApiKeys { + /** + * List the api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 api keys for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + DatadogApiKey getDefaultKey(String resourceGroupName, String monitorName); + + /** + * Get the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 default api key. + */ + Response getDefaultKeyWithResponse(String resourceGroupName, String monitorName, Context context); + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 setDefaultKey(String resourceGroupName, String monitorName); + + /** + * Set the default api key. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response setDefaultKeyWithResponse( + String resourceGroupName, String monitorName, DatadogApiKeyInner body, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementProperties.java new file mode 100644 index 000000000000..f7b3a1057838 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementProperties.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Terms properties. */ +@Fluent +public final class DatadogAgreementProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogAgreementProperties.class); + + /* + * Publisher identifier string. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Product identifier string. + */ + @JsonProperty(value = "product") + private String product; + + /* + * Plan identifier string. + */ + @JsonProperty(value = "plan") + private String plan; + + /* + * Link to HTML with Microsoft and Publisher terms. + */ + @JsonProperty(value = "licenseTextLink") + private String licenseTextLink; + + /* + * Link to the privacy policy of the publisher. + */ + @JsonProperty(value = "privacyPolicyLink") + private String privacyPolicyLink; + + /* + * Date and time in UTC of when the terms were accepted. This is empty if + * Accepted is false. + */ + @JsonProperty(value = "retrieveDatetime") + private OffsetDateTime retrieveDatetime; + + /* + * Terms signature. + */ + @JsonProperty(value = "signature") + private String signature; + + /* + * If any version of the terms have been accepted, otherwise false. + */ + @JsonProperty(value = "accepted") + private Boolean accepted; + + /** + * Get the publisher property: Publisher identifier string. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Publisher identifier string. + * + * @param publisher the publisher value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: Product identifier string. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: Product identifier string. + * + * @param product the product value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the plan property: Plan identifier string. + * + * @return the plan value. + */ + public String plan() { + return this.plan; + } + + /** + * Set the plan property: Plan identifier string. + * + * @param plan the plan value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withPlan(String plan) { + this.plan = plan; + return this; + } + + /** + * Get the licenseTextLink property: Link to HTML with Microsoft and Publisher terms. + * + * @return the licenseTextLink value. + */ + public String licenseTextLink() { + return this.licenseTextLink; + } + + /** + * Set the licenseTextLink property: Link to HTML with Microsoft and Publisher terms. + * + * @param licenseTextLink the licenseTextLink value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withLicenseTextLink(String licenseTextLink) { + this.licenseTextLink = licenseTextLink; + return this; + } + + /** + * Get the privacyPolicyLink property: Link to the privacy policy of the publisher. + * + * @return the privacyPolicyLink value. + */ + public String privacyPolicyLink() { + return this.privacyPolicyLink; + } + + /** + * Set the privacyPolicyLink property: Link to the privacy policy of the publisher. + * + * @param privacyPolicyLink the privacyPolicyLink value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withPrivacyPolicyLink(String privacyPolicyLink) { + this.privacyPolicyLink = privacyPolicyLink; + return this; + } + + /** + * Get the retrieveDatetime property: Date and time in UTC of when the terms were accepted. This is empty if + * Accepted is false. + * + * @return the retrieveDatetime value. + */ + public OffsetDateTime retrieveDatetime() { + return this.retrieveDatetime; + } + + /** + * Set the retrieveDatetime property: Date and time in UTC of when the terms were accepted. This is empty if + * Accepted is false. + * + * @param retrieveDatetime the retrieveDatetime value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withRetrieveDatetime(OffsetDateTime retrieveDatetime) { + this.retrieveDatetime = retrieveDatetime; + return this; + } + + /** + * Get the signature property: Terms signature. + * + * @return the signature value. + */ + public String signature() { + return this.signature; + } + + /** + * Set the signature property: Terms signature. + * + * @param signature the signature value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withSignature(String signature) { + this.signature = signature; + return this; + } + + /** + * Get the accepted property: If any version of the terms have been accepted, otherwise false. + * + * @return the accepted value. + */ + public Boolean accepted() { + return this.accepted; + } + + /** + * Set the accepted property: If any version of the terms have been accepted, otherwise false. + * + * @param accepted the accepted value to set. + * @return the DatadogAgreementProperties object itself. + */ + public DatadogAgreementProperties withAccepted(Boolean accepted) { + this.accepted = accepted; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResource.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResource.java new file mode 100644 index 000000000000..f283b5272f28 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResource.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.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; + +/** An immutable client-side representation of DatadogAgreementResource. */ +public interface DatadogAgreementResource { + /** + * 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: Represents the properties of the resource. + * + * @return the properties value. + */ + DatadogAgreementProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner object. + * + * @return the inner object. + */ + DatadogAgreementResourceInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResourceListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResourceListResponse.java new file mode 100644 index 000000000000..e14c49fbc873 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogAgreementResourceListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; +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 DatadogAgreementResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogAgreementResourceListResponse.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 DatadogAgreementResourceListResponse object itself. + */ + public DatadogAgreementResourceListResponse 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 DatadogAgreementResourceListResponse object itself. + */ + public DatadogAgreementResourceListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKey.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKey.java new file mode 100644 index 000000000000..039fe722931f --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKey.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.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; + +/** An immutable client-side representation of DatadogApiKey. */ +public interface DatadogApiKey { + /** + * Gets the createdBy property: The user that created the API key. + * + * @return the createdBy value. + */ + String createdBy(); + + /** + * Gets the name property: The name of the API key. + * + * @return the name value. + */ + String name(); + + /** + * Gets the key property: The value of the API key. + * + * @return the key value. + */ + String key(); + + /** + * Gets the created property: The time of creation of the API key. + * + * @return the created value. + */ + String created(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner object. + * + * @return the inner object. + */ + DatadogApiKeyInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKeyListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKeyListResponse.java new file mode 100644 index 000000000000..b1db4426c251 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogApiKeyListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.DatadogApiKeyInner; +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 DatadogApiKeyListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogApiKeyListResponse.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 DatadogApiKeyListResponse object itself. + */ + public DatadogApiKeyListResponse 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 DatadogApiKeyListResponse object itself. + */ + public DatadogApiKeyListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHost.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHost.java new file mode 100644 index 000000000000..8c9645f32875 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHost.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.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner; +import java.util.List; + +/** An immutable client-side representation of DatadogHost. */ +public interface DatadogHost { + /** + * Gets the name property: The name of the host. + * + * @return the name value. + */ + String name(); + + /** + * Gets the aliases property: The aliases for the host. + * + * @return the aliases value. + */ + List aliases(); + + /** + * Gets the apps property: The Datadog integrations reporting metrics for the host. + * + * @return the apps value. + */ + List apps(); + + /** + * Gets the meta property: The meta property. + * + * @return the meta value. + */ + DatadogHostMetadata meta(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner object. + * + * @return the inner object. + */ + DatadogHostInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostListResponse.java new file mode 100644 index 000000000000..498f50b9b8f8 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.DatadogHostInner; +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 DatadogHostListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogHostListResponse.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 DatadogHostListResponse object itself. + */ + public DatadogHostListResponse 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 DatadogHostListResponse object itself. + */ + public DatadogHostListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostMetadata.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostMetadata.java new file mode 100644 index 000000000000..3f69cd369cea --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogHostMetadata.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 DatadogHostMetadata model. */ +@Fluent +public final class DatadogHostMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogHostMetadata.class); + + /* + * The agent version. + */ + @JsonProperty(value = "agentVersion") + private String agentVersion; + + /* + * The installMethod property. + */ + @JsonProperty(value = "installMethod") + private DatadogInstallMethod installMethod; + + /* + * The logsAgent property. + */ + @JsonProperty(value = "logsAgent") + private DatadogLogsAgent logsAgent; + + /** + * Get the agentVersion property: The agent version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: The agent version. + * + * @param agentVersion the agentVersion value to set. + * @return the DatadogHostMetadata object itself. + */ + public DatadogHostMetadata withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the installMethod property: The installMethod property. + * + * @return the installMethod value. + */ + public DatadogInstallMethod installMethod() { + return this.installMethod; + } + + /** + * Set the installMethod property: The installMethod property. + * + * @param installMethod the installMethod value to set. + * @return the DatadogHostMetadata object itself. + */ + public DatadogHostMetadata withInstallMethod(DatadogInstallMethod installMethod) { + this.installMethod = installMethod; + return this; + } + + /** + * Get the logsAgent property: The logsAgent property. + * + * @return the logsAgent value. + */ + public DatadogLogsAgent logsAgent() { + return this.logsAgent; + } + + /** + * Set the logsAgent property: The logsAgent property. + * + * @param logsAgent the logsAgent value to set. + * @return the DatadogHostMetadata object itself. + */ + public DatadogHostMetadata withLogsAgent(DatadogLogsAgent logsAgent) { + this.logsAgent = logsAgent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (installMethod() != null) { + installMethod().validate(); + } + if (logsAgent() != null) { + logsAgent().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogInstallMethod.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogInstallMethod.java new file mode 100644 index 000000000000..c17c47cb647d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogInstallMethod.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 DatadogInstallMethod model. */ +@Fluent +public final class DatadogInstallMethod { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogInstallMethod.class); + + /* + * The tool. + */ + @JsonProperty(value = "tool") + private String tool; + + /* + * The tool version. + */ + @JsonProperty(value = "toolVersion") + private String toolVersion; + + /* + * The installer version. + */ + @JsonProperty(value = "installerVersion") + private String installerVersion; + + /** + * Get the tool property: The tool. + * + * @return the tool value. + */ + public String tool() { + return this.tool; + } + + /** + * Set the tool property: The tool. + * + * @param tool the tool value to set. + * @return the DatadogInstallMethod object itself. + */ + public DatadogInstallMethod withTool(String tool) { + this.tool = tool; + return this; + } + + /** + * Get the toolVersion property: The tool version. + * + * @return the toolVersion value. + */ + public String toolVersion() { + return this.toolVersion; + } + + /** + * Set the toolVersion property: The tool version. + * + * @param toolVersion the toolVersion value to set. + * @return the DatadogInstallMethod object itself. + */ + public DatadogInstallMethod withToolVersion(String toolVersion) { + this.toolVersion = toolVersion; + return this; + } + + /** + * Get the installerVersion property: The installer version. + * + * @return the installerVersion value. + */ + public String installerVersion() { + return this.installerVersion; + } + + /** + * Set the installerVersion property: The installer version. + * + * @param installerVersion the installerVersion value to set. + * @return the DatadogInstallMethod object itself. + */ + public DatadogInstallMethod withInstallerVersion(String installerVersion) { + this.installerVersion = installerVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogLogsAgent.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogLogsAgent.java new file mode 100644 index 000000000000..64a4c7731f13 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogLogsAgent.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 DatadogLogsAgent model. */ +@Fluent +public final class DatadogLogsAgent { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogLogsAgent.class); + + /* + * The transport. + */ + @JsonProperty(value = "transport") + private String transport; + + /** + * Get the transport property: The transport. + * + * @return the transport value. + */ + public String transport() { + return this.transport; + } + + /** + * Set the transport property: The transport. + * + * @param transport the transport value to set. + * @return the DatadogLogsAgent object itself. + */ + public DatadogLogsAgent withTransport(String transport) { + this.transport = transport; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResource.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResource.java new file mode 100644 index 000000000000..3fff936f03df --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResource.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner; +import java.util.Map; + +/** An immutable client-side representation of DatadogMonitorResource. */ +public interface DatadogMonitorResource { + /** + * 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: The sku property. + * + * @return the sku value. + */ + ResourceSku sku(); + + /** + * Gets the properties property: Properties specific to the monitor resource. + * + * @return the properties value. + */ + MonitorProperties properties(); + + /** + * Gets the identity property: The identity property. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner object. + * + * @return the inner object. + */ + DatadogMonitorResourceInner innerModel(); + + /** The entirety of the DatadogMonitorResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DatadogMonitorResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DatadogMonitorResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DatadogMonitorResource 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 DatadogMonitorResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DatadogMonitorResource 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. + */ + DatadogMonitorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatadogMonitorResource create(Context context); + } + /** The stage of the DatadogMonitorResource 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 DatadogMonitorResource definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The sku property.. + * + * @param sku The sku property. + * @return the next definition stage. + */ + WithCreate withSku(ResourceSku sku); + } + /** The stage of the DatadogMonitorResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties specific to the monitor resource.. + * + * @param properties Properties specific to the monitor resource. + * @return the next definition stage. + */ + WithCreate withProperties(MonitorProperties properties); + } + /** The stage of the DatadogMonitorResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity property.. + * + * @param identity The identity property. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + /** + * Begins update for the DatadogMonitorResource resource. + * + * @return the stage of resource update. + */ + DatadogMonitorResource.Update update(); + + /** The template for DatadogMonitorResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatadogMonitorResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatadogMonitorResource apply(Context context); + } + /** The DatadogMonitorResource update stages. */ + interface UpdateStages { + /** The stage of the DatadogMonitorResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The new tags of the monitor resource.. + * + * @param tags The new tags of the monitor resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the DatadogMonitorResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The set of properties that can be update in a PATCH request to a + * monitor resource.. + * + * @param properties The set of properties that can be update in a PATCH request to a monitor resource. + * @return the next definition stage. + */ + Update withProperties(MonitorUpdateProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatadogMonitorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatadogMonitorResource refresh(Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceListResponse.java new file mode 100644 index 000000000000..5482e72b44d7 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.DatadogMonitorResourceInner; +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 DatadogMonitorResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogMonitorResourceListResponse.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 DatadogMonitorResourceListResponse object itself. + */ + public DatadogMonitorResourceListResponse 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 DatadogMonitorResourceListResponse object itself. + */ + public DatadogMonitorResourceListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceUpdateParameters.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceUpdateParameters.java new file mode 100644 index 000000000000..74b282510f6c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogMonitorResourceUpdateParameters.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The parameters for a PATCH request to a monitor resource. */ +@Fluent +public final class DatadogMonitorResourceUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogMonitorResourceUpdateParameters.class); + + /* + * The set of properties that can be update in a PATCH request to a monitor + * resource. + */ + @JsonProperty(value = "properties") + private MonitorUpdateProperties properties; + + /* + * The new tags of the monitor resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the properties property: The set of properties that can be update in a PATCH request to a monitor resource. + * + * @return the properties value. + */ + public MonitorUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The set of properties that can be update in a PATCH request to a monitor resource. + * + * @param properties the properties value to set. + * @return the DatadogMonitorResourceUpdateParameters object itself. + */ + public DatadogMonitorResourceUpdateParameters withProperties(MonitorUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: The new tags of the monitor resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The new tags of the monitor resource. + * + * @param tags the tags value to set. + * @return the DatadogMonitorResourceUpdateParameters object itself. + */ + public DatadogMonitorResourceUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogOrganizationProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogOrganizationProperties.java new file mode 100644 index 000000000000..dcc38748dd6c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogOrganizationProperties.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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; + +/** Datadog organization properties. */ +@Fluent +public final class DatadogOrganizationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogOrganizationProperties.class); + + /* + * Name of the Datadog organization. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Id of the Datadog organization. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The auth code used to linking to an existing datadog organization. + */ + @JsonProperty(value = "linkingAuthCode") + private String linkingAuthCode; + + /* + * The client_id from an existing in exchange for an auth token to link + * organization. + */ + @JsonProperty(value = "linkingClientId") + private String linkingClientId; + + /* + * The Id of the Enterprise App used for Single sign on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /** + * Get the name property: Name of the Datadog organization. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the id property: Id of the Datadog organization. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the linkingAuthCode property: The auth code used to linking to an existing datadog organization. + * + * @return the linkingAuthCode value. + */ + public String linkingAuthCode() { + return this.linkingAuthCode; + } + + /** + * Set the linkingAuthCode property: The auth code used to linking to an existing datadog organization. + * + * @param linkingAuthCode the linkingAuthCode value to set. + * @return the DatadogOrganizationProperties object itself. + */ + public DatadogOrganizationProperties withLinkingAuthCode(String linkingAuthCode) { + this.linkingAuthCode = linkingAuthCode; + return this; + } + + /** + * Get the linkingClientId property: The client_id from an existing in exchange for an auth token to link + * organization. + * + * @return the linkingClientId value. + */ + public String linkingClientId() { + return this.linkingClientId; + } + + /** + * Set the linkingClientId property: The client_id from an existing in exchange for an auth token to link + * organization. + * + * @param linkingClientId the linkingClientId value to set. + * @return the DatadogOrganizationProperties object itself. + */ + public DatadogOrganizationProperties withLinkingClientId(String linkingClientId) { + this.linkingClientId = linkingClientId; + return this; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the DatadogOrganizationProperties object itself. + */ + public DatadogOrganizationProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSetPasswordLink.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSetPasswordLink.java new file mode 100644 index 000000000000..dbe79d777fc0 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSetPasswordLink.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.DatadogSetPasswordLinkInner; + +/** An immutable client-side representation of DatadogSetPasswordLink. */ +public interface DatadogSetPasswordLink { + /** + * Gets the setPasswordLink property: The setPasswordLink property. + * + * @return the setPasswordLink value. + */ + String setPasswordLink(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogSetPasswordLinkInner object. + * + * @return the inner object. + */ + DatadogSetPasswordLinkInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnProperties.java new file mode 100644 index 000000000000..3873b9f13e3d --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 DatadogSingleSignOnProperties model. */ +@Fluent +public final class DatadogSingleSignOnProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogSingleSignOnProperties.class); + + /* + * Various states of the SSO resource + */ + @JsonProperty(value = "singleSignOnState") + private SingleSignOnStates singleSignOnState; + + /* + * The Id of the Enterprise App used for Single sign-on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /* + * The login URL specific to this Datadog Organization. + */ + @JsonProperty(value = "singleSignOnUrl", access = JsonProperty.Access.WRITE_ONLY) + private String singleSignOnUrl; + + /** + * Get the singleSignOnState property: Various states of the SSO resource. + * + * @return the singleSignOnState value. + */ + public SingleSignOnStates singleSignOnState() { + return this.singleSignOnState; + } + + /** + * Set the singleSignOnState property: Various states of the SSO resource. + * + * @param singleSignOnState the singleSignOnState value to set. + * @return the DatadogSingleSignOnProperties object itself. + */ + public DatadogSingleSignOnProperties withSingleSignOnState(SingleSignOnStates singleSignOnState) { + this.singleSignOnState = singleSignOnState; + return this; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the DatadogSingleSignOnProperties object itself. + */ + public DatadogSingleSignOnProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the singleSignOnUrl property: The login URL specific to this Datadog Organization. + * + * @return the singleSignOnUrl value. + */ + public String singleSignOnUrl() { + return this.singleSignOnUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResource.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResource.java new file mode 100644 index 000000000000..a111fc769f4c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResource.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.datadog.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner; + +/** An immutable client-side representation of DatadogSingleSignOnResource. */ +public interface DatadogSingleSignOnResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + DatadogSingleSignOnProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner object. + * + * @return the inner object. + */ + DatadogSingleSignOnResourceInner innerModel(); + + /** The entirety of the DatadogSingleSignOnResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatadogSingleSignOnResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DatadogSingleSignOnResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatadogSingleSignOnResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the DatadogSingleSignOnResource 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. + */ + DatadogSingleSignOnResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatadogSingleSignOnResource create(Context context); + } + /** The stage of the DatadogSingleSignOnResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties property.. + * + * @param properties The properties property. + * @return the next definition stage. + */ + WithCreate withProperties(DatadogSingleSignOnProperties properties); + } + } + /** + * Begins update for the DatadogSingleSignOnResource resource. + * + * @return the stage of resource update. + */ + DatadogSingleSignOnResource.Update update(); + + /** The template for DatadogSingleSignOnResource update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatadogSingleSignOnResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatadogSingleSignOnResource apply(Context context); + } + /** The DatadogSingleSignOnResource update stages. */ + interface UpdateStages { + /** The stage of the DatadogSingleSignOnResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties property.. + * + * @param properties The properties property. + * @return the next definition stage. + */ + Update withProperties(DatadogSingleSignOnProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatadogSingleSignOnResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatadogSingleSignOnResource refresh(Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResourceListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResourceListResponse.java new file mode 100644 index 000000000000..b932d0b53a12 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/DatadogSingleSignOnResourceListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.DatadogSingleSignOnResourceInner; +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 DatadogSingleSignOnResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatadogSingleSignOnResourceListResponse.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 DatadogSingleSignOnResourceListResponse object itself. + */ + public DatadogSingleSignOnResourceListResponse 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 DatadogSingleSignOnResourceListResponse object itself. + */ + public DatadogSingleSignOnResourceListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/FilteringTag.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/FilteringTag.java new file mode 100644 index 000000000000..9e23e3900c32 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/FilteringTag.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from + * being monitored. + */ +@Fluent +public final class FilteringTag { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FilteringTag.class); + + /* + * The name (also known as the key) of the tag. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the tag. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Valid actions for a filtering tag. Exclusion takes priority over + * inclusion. + */ + @JsonProperty(value = "action") + private TagAction action; + + /** + * Get the name property: The name (also known as the key) of the tag. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name (also known as the key) of the tag. + * + * @param name the name value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the tag. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the tag. + * + * @param value the value value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @return the action value. + */ + public TagAction action() { + return this.action; + } + + /** + * Set the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @param action the action value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withAction(TagAction action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Hosts.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Hosts.java new file mode 100644 index 000000000000..5584638121b7 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Hosts.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.datadog.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Hosts. */ +public interface Hosts { + /** + * List the hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 hosts for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/IdentityProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/IdentityProperties.java new file mode 100644 index 000000000000..990d5636c311 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The IdentityProperties model. */ +@Fluent +public final class IdentityProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IdentityProperties.class); + + /* + * The identity ID. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * 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: Identity type. + * + * @return the type value. + */ + public ManagedIdentityTypes type() { + return this.type; + } + + /** + * Set the type property: 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LiftrResourceCategories.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LiftrResourceCategories.java new file mode 100644 index 000000000000..36983168e7d9 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResource.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResource.java new file mode 100644 index 000000000000..189e4a847477 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResource.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner; + +/** An immutable client-side representation of LinkedResource. */ +public interface LinkedResource { + /** + * Gets the id property: The ARM id of the linked resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner object. + * + * @return the inner object. + */ + LinkedResourceInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResourceListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResourceListResponse.java new file mode 100644 index 000000000000..e011780a8614 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResourceListResponse.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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.fluent.models.LinkedResourceInner; +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 LinkedResourceListResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedResourceListResponse.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 LinkedResourceListResponse object itself. + */ + public LinkedResourceListResponse 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 LinkedResourceListResponse object itself. + */ + public LinkedResourceListResponse 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResources.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResources.java new file mode 100644 index 000000000000..11221919d62e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LinkedResources.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.datadog.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LinkedResources. */ +public interface LinkedResources { + /** + * List all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 all Azure resources associated to the same Datadog organization as the target resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LogRules.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/LogRules.java new file mode 100644 index 000000000000..ff6bc2334e1f --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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 Azure subscription logs should be sent for the + * Monitor resource. + */ + @JsonProperty(value = "sendSubscriptionLogs") + private Boolean sendSubscriptionLogs; + + /* + * Flag specifying if Azure resource logs should be sent for the Monitor + * resource. + */ + @JsonProperty(value = "sendResourceLogs") + private Boolean sendResourceLogs; + + /* + * List of filtering tags to be used for capturing logs. This only takes + * effect if SendResourceLogs 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 Azure 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 Azure 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 sendResourceLogs property: Flag specifying if Azure resource logs should be sent for the Monitor + * resource. + * + * @return the sendResourceLogs value. + */ + public Boolean sendResourceLogs() { + return this.sendResourceLogs; + } + + /** + * Set the sendResourceLogs property: Flag specifying if Azure resource logs should be sent for the Monitor + * resource. + * + * @param sendResourceLogs the sendResourceLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendResourceLogs(Boolean sendResourceLogs) { + this.sendResourceLogs = sendResourceLogs; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendResourceLogs 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 + * SendResourceLogs 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ManagedIdentityTypes.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ManagedIdentityTypes.java new file mode 100644 index 000000000000..e30aabf38ae1 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ManagedIdentityTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedIdentityTypes. */ +public final class ManagedIdentityTypes extends ExpandableStringEnum { + /** Static value SystemAssigned for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates or finds a ManagedIdentityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedIdentityTypes. + */ + @JsonCreator + public static ManagedIdentityTypes fromString(String name) { + return fromString(name, ManagedIdentityTypes.class); + } + + /** @return known ManagedIdentityTypes values. */ + public static Collection values() { + return values(ManagedIdentityTypes.class); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceAgreements.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceAgreements.java new file mode 100644 index 000000000000..016574d5b357 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceAgreements.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.fluent.models.DatadogAgreementResourceInner; + +/** Resource collection API of MarketplaceAgreements. */ +public interface MarketplaceAgreements { + /** + * List Datadog marketplace agreements in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + PagedIterable list(); + + /** + * List Datadog marketplace agreements in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list operation. + */ + PagedIterable list(Context context); + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + DatadogAgreementResource create(); + + /** + * Create Datadog marketplace agreement in the subscription. + * + * @param body The body parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response createWithResponse(DatadogAgreementResourceInner body, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceSubscriptionStatus.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 000000000000..70ddd748967e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MarketplaceSubscriptionStatus. */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** Static value Active for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus ACTIVE = fromString("Active"); + + /** Static value Suspended for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + @JsonCreator + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** @return known MarketplaceSubscriptionStatus values. */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MetricRules.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MetricRules.java new file mode 100644 index 000000000000..992c7d9368f3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MetricRules.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 metrics for the Monitor resource. */ +@Fluent +public final class MetricRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricRules.class); + + /* + * List of filtering tags to be used for capturing metrics. 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 filteringTags property: List of filtering tags to be used for capturing metrics. 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 metrics. 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 MetricRules object itself. + */ + public MetricRules 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorProperties.java new file mode 100644 index 000000000000..c5eb7885781e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorProperties.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties specific to the monitor resource. */ +@Fluent +public final class MonitorProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorProperties.class); + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * Flag specifying if the resource monitoring is enabled or disabled. + */ + @JsonProperty(value = "monitoringStatus", access = JsonProperty.Access.WRITE_ONLY) + private MonitoringStatus monitoringStatus; + + /* + * Flag specifying the Marketplace Subscription Status of the resource. If + * payment is not made in time, the resource will go in Suspended state. + */ + @JsonProperty(value = "marketplaceSubscriptionStatus", access = JsonProperty.Access.WRITE_ONLY) + private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus; + + /* + * Datadog organization properties + */ + @JsonProperty(value = "datadogOrganizationProperties") + private DatadogOrganizationProperties datadogOrganizationProperties; + + /* + * User info + */ + @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: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The provisioningState property. + * + * @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; + } + + /** + * Get the marketplaceSubscriptionStatus property: Flag specifying the Marketplace Subscription Status of the + * resource. If payment is not made in time, the resource will go in Suspended state. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.marketplaceSubscriptionStatus; + } + + /** + * Get the datadogOrganizationProperties property: Datadog organization properties. + * + * @return the datadogOrganizationProperties value. + */ + public DatadogOrganizationProperties datadogOrganizationProperties() { + return this.datadogOrganizationProperties; + } + + /** + * Set the datadogOrganizationProperties property: Datadog organization properties. + * + * @param datadogOrganizationProperties the datadogOrganizationProperties value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withDatadogOrganizationProperties( + DatadogOrganizationProperties datadogOrganizationProperties) { + this.datadogOrganizationProperties = datadogOrganizationProperties; + return this; + } + + /** + * Get the userInfo property: User info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User info. + * + * @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 (datadogOrganizationProperties() != null) { + datadogOrganizationProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorUpdateProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorUpdateProperties.java new file mode 100644 index 000000000000..e8367b3c7974 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitorUpdateProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The set of properties that can be update in a PATCH request to a monitor resource. */ +@Immutable +public final class MonitorUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MonitorUpdateProperties.class); + + /* + * Flag specifying if the resource monitoring is enabled or disabled. + */ + @JsonProperty(value = "monitoringStatus", access = JsonProperty.Access.WRITE_ONLY) + private MonitoringStatus monitoringStatus; + + /** + * Get the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.monitoringStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResource.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResource.java new file mode 100644 index 000000000000..e0d3a6ef19b2 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResource.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.resourcemanager.datadog.fluent.models.MonitoredResourceInner; + +/** An immutable client-side representation of MonitoredResource. */ +public interface MonitoredResource { + /** + * Gets the id property: The ARM id of the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the sendingMetrics property: Flag indicating if resource is sending metrics to Datadog. + * + * @return the sendingMetrics value. + */ + Boolean sendingMetrics(); + + /** + * Gets the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + String reasonForMetricsStatus(); + + /** + * Gets the sendingLogs property: Flag indicating if resource is sending logs to Datadog. + * + * @return the sendingLogs value. + */ + Boolean 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.datadog.fluent.models.MonitoredResourceInner object. + * + * @return the inner object. + */ + MonitoredResourceInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResourceListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResourceListResponse.java new file mode 100644 index 000000000000..83c6ebe791bf --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResources.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoredResources.java new file mode 100644 index 000000000000..7315369fa3a4 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringStatus.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringStatus.java new file mode 100644 index 000000000000..01f83050ac41 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRules.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRules.java new file mode 100644 index 000000000000..56c9f68ea64c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRules.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.datadog.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.datadog.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: Definition of the properties for a TagRules resource. + * + * @return the properties value. + */ + MonitoringTagRulesProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.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 Datadog 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: Definition of the properties for a TagRules resource.. + * + * @param properties Definition of the properties for a TagRules resource. + * @return the next definition stage. + */ + WithCreate withProperties(MonitoringTagRulesProperties properties); + } + } + /** + * Begins update for the MonitoringTagRules resource. + * + * @return the stage of resource update. + */ + MonitoringTagRules.Update update(); + + /** The template for MonitoringTagRules update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MonitoringTagRules apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MonitoringTagRules apply(Context context); + } + /** The MonitoringTagRules update stages. */ + interface UpdateStages { + /** The stage of the MonitoringTagRules update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Definition of the properties for a TagRules resource.. + * + * @param properties Definition of the properties for a TagRules resource. + * @return the next definition stage. + */ + Update withProperties(MonitoringTagRulesProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MonitoringTagRules refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MonitoringTagRules refresh(Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRulesListResponse.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRulesListResponse.java new file mode 100644 index 000000000000..3a676963a9ca --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRulesProperties.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRulesProperties.java new file mode 100644 index 000000000000..aab6fde1c741 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/MonitoringTagRulesProperties.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.datadog.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); + + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Set of rules for sending metrics for the Monitor resource. + */ + @JsonProperty(value = "metricRules") + private MetricRules metricRules; + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the MonitoringTagRulesProperties object itself. + */ + public MonitoringTagRulesProperties withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRules metricRules() { + return this.metricRules; + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the MonitoringTagRulesProperties object itself. + */ + public MonitoringTagRulesProperties withMetricRules(MetricRules metricRules) { + this.metricRules = metricRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + if (metricRules() != null) { + metricRules().validate(); + } + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Monitors.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Monitors.java new file mode 100644 index 000000000000..4183a76d299c --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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 Datadog 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 Datadog 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 Datadog 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. + */ + DatadogMonitorResource getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Get the properties of a specific monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 Datadog 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 Datadog 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. + */ + DatadogMonitorResource 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 DatadogMonitorResource resource. + * + * @param name resource name. + * @return the first stage of the new DatadogMonitorResource definition. + */ + DatadogMonitorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationDisplay.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationDisplay.java new file mode 100644 index 000000000000..6f0941189c5e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.Datadog. + */ + @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.Datadog. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider, i.e., Microsoft.Datadog. + * + * @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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationListResult.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationListResult.java new file mode 100644 index 000000000000..4f7608447f67 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.datadog.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.Datadog operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Microsoft.Datadog 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.Datadog provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Microsoft.Datadog 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationResult.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationResult.java new file mode 100644 index 000000000000..12d50de265db --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/OperationResult.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.datadog.models; + +import com.azure.resourcemanager.datadog.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 display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.datadog.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Operations.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/Operations.java new file mode 100644 index 000000000000..d81bac8264ee --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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.Datadog for the 2020-02-01-preview api version. + * + * @throws com.azure.core.management.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.Datadog for the 2020-02-01-preview api version. + * + * @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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ProvisioningState.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ProvisioningState.java new file mode 100644 index 000000000000..08f3d59dcdc8 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/RefreshSetPasswords.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/RefreshSetPasswords.java new file mode 100644 index 000000000000..a10463991d2e --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/RefreshSetPasswords.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.datadog.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RefreshSetPasswords. */ +public interface RefreshSetPasswords { + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + DatadogSetPasswordLink get(String resourceGroupName, String monitorName); + + /** + * Refresh the set password link and return a latest one. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 response. + */ + Response getWithResponse(String resourceGroupName, String monitorName, Context context); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ResourceSku.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/ResourceSku.java new file mode 100644 index 000000000000..d5d761a78fb3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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 ResourceSku model. */ +@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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnConfigurations.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnConfigurations.java new file mode 100644 index 000000000000..a2ab00a45312 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnConfigurations.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 SingleSignOnConfigurations. */ +public interface SingleSignOnConfigurations { + /** + * List the single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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 single sign-on configurations for a given monitor resource. + * + * @param resourceGroupName The name of the resource group to which the Datadog 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); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + DatadogSingleSignOnResource get(String resourceGroupName, String monitorName, String configurationName); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param resourceGroupName The name of the resource group to which the Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param configurationName Configuration 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 datadog single sign-on resource for the given Monitor. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String configurationName, Context context); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the datadog single sign-on resource for the given Monitor. + */ + DatadogSingleSignOnResource getById(String id); + + /** + * Gets the datadog single sign-on resource for the given Monitor. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the datadog single sign-on resource for the given Monitor. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatadogSingleSignOnResource resource. + * + * @param name resource name. + * @return the first stage of the new DatadogSingleSignOnResource definition. + */ + DatadogSingleSignOnResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnStates.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnStates.java new file mode 100644 index 000000000000..b51493fdb0b2 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/SingleSignOnStates.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SingleSignOnStates. */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** Static value Initial for SingleSignOnStates. */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** Static value Enable for SingleSignOnStates. */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** Static value Disable for SingleSignOnStates. */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** Static value Existing for SingleSignOnStates. */ + public static final SingleSignOnStates EXISTING = fromString("Existing"); + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + @JsonCreator + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** @return known SingleSignOnStates values. */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/TagAction.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/TagAction.java new file mode 100644 index 000000000000..fda11239edb3 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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.datadog.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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/TagRules.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/TagRules.java new file mode 100644 index 000000000000..de7f1c77d596 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/TagRules.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 Datadog 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 Datadog 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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 Datadog resource belongs. + * @param monitorName Monitor resource name. + * @param ruleSetName Rule set 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); + + /** + * 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); + + /** + * 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/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/UserInfo.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/UserInfo.java new file mode 100644 index 000000000000..5a70beffb3c4 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/UserInfo.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.datadog.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 info. */ +@Fluent +public final class UserInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserInfo.class); + + /* + * Name of the user + */ + @JsonProperty(value = "name") + private String name; + + /* + * Email of the user used by Datadog for contacting them if needed + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * Phone number of the user used by Datadog for contacting them if needed + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Get the name property: Name of the user. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the user. + * + * @param name the name value to set. + * @return the UserInfo object itself. + */ + public UserInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the emailAddress property: Email of the user used by Datadog 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 Datadog for contacting them if needed. + * + * @param emailAddress the emailAddress value to set. + * @return the UserInfo object itself. + */ + public UserInfo withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the phoneNumber property: Phone number of the user used by Datadog for contacting them if needed. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number of the user used by Datadog for contacting them if needed. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserInfo object itself. + */ + public UserInfo withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/package-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/models/package-info.java new file mode 100644 index 000000000000..e83b35fb6451 --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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 MicrosoftDatadogClient. null. */ +package com.azure.resourcemanager.datadog.models; diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/package-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/package-info.java new file mode 100644 index 000000000000..0344ae875b6f --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/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 MicrosoftDatadogClient. null. */ +package com.azure.resourcemanager.datadog; diff --git a/sdk/datadog/azure-resourcemanager-datadog/src/main/java/module-info.java b/sdk/datadog/azure-resourcemanager-datadog/src/main/java/module-info.java new file mode 100644 index 000000000000..45e4240fa6af --- /dev/null +++ b/sdk/datadog/azure-resourcemanager-datadog/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.datadog { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.datadog; + exports com.azure.resourcemanager.datadog.fluent; + exports com.azure.resourcemanager.datadog.fluent.models; + exports com.azure.resourcemanager.datadog.models; + + opens com.azure.resourcemanager.datadog.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.datadog.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/datadog/ci.yml b/sdk/datadog/ci.yml new file mode 100644 index 000000000000..0d5dce1f2b5e --- /dev/null +++ b/sdk/datadog/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: datadog + Artifacts: + - name: azure-resourcemanager-datadog + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdatadog diff --git a/sdk/datadog/pom.xml b/sdk/datadog/pom.xml new file mode 100644 index 000000000000..ab53aaaee58e --- /dev/null +++ b/sdk/datadog/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-datadog-service + pom + 1.0.0 + + azure-resourcemanager-datadog + +