diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566fee..464bc9b7cf1a 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee36..c9d465e10e6f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -40,17 +40,22 @@ com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2 com.azure:azure-ai-formrecognizer;3.0.3;3.1.0-beta.2 com.azure:azure-ai-metricsadvisor;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-ai-textanalytics;5.0.1;5.1.0-beta.4 +com.azure:azure-analytics-synapse-accesscontrol;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-artifacts;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-spark;1.0.0-beta.1;1.0.0-beta.2 +com.azure:azure-analytics-synapse-managedprivateendpoints;1.0.0-beta.1;1.0.0-beta.1 +com.azure:azure-analytics-synapse-monitoring;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -58,7 +63,7 @@ com.azure:azure-core-serializer-json-gson;1.0.3;1.1.0-beta.1 com.azure:azure-core-serializer-json-jackson;1.1.0;1.2.0-beta.1 com.azure:azure-core-test;1.5.1;1.6.0-beta.1 com.azure:azure-core-tracing-opentelemetry;1.0.0-beta.6;1.0.0-beta.7 -com.azure:azure-cosmos;4.8.0;4.9.0-beta.1 +com.azure:azure-cosmos;4.9.0;4.10.0-beta.1 com.azure:azure-cosmos-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-dotnet-benchmark;4.0.1-beta.1;4.0.1-beta.1 com.azure:azure-cosmos-encryption;1.0.0-beta.1;1.0.0-beta.1 @@ -68,12 +73,12 @@ com.azure:azure-data-schemaregistry-avro;1.0.0-beta.4;1.0.0-beta.5 com.azure:azure-data-tables;12.0.0-beta.3;12.0.0-beta.4 com.azure:azure-digitaltwins-core;1.0.1;1.1.0-beta.1 com.azure:azure-e2e;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-identity;1.2.0;1.3.0-beta.1 +com.azure:azure-identity;1.2.0;1.2.1 com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -84,19 +89,19 @@ com.azure:azure-security-keyvault-jca;1.0.0-beta.2;1.0.0-beta.3 com.azure:azure-security-keyvault-keys;4.2.3;4.3.0-beta.4 com.azure:azure-security-keyvault-secrets;4.2.3;4.3.0-beta.3 com.azure:azure-sdk-template;1.2.1-beta.2;1.2.1-beta.16 -com.azure:azure-spring-data-cosmos;3.1.0;3.2.0-beta.1 +com.azure:azure-spring-data-cosmos;3.2.0;3.3.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-blob;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-blob-batch;12.7.0;12.8.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.4;12.0.0-beta.5 -com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.9.0;12.10.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.2;12.0.0-beta.3 -com.azure:azure-storage-common;12.9.0;12.10.0-beta.1 -com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.1 -com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.1 -com.azure:azure-storage-internal-avro;12.0.1;12.1.0-beta.1 +com.azure:azure-storage-common;12.9.0;12.10.0-beta.2 +com.azure:azure-storage-file-share;12.7.0;12.8.0-beta.2 +com.azure:azure-storage-file-datalake;12.3.0;12.4.0-beta.2 +com.azure:azure-storage-internal-avro;12.0.1;12.0.2-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.7.0;12.8.0-beta.1 +com.azure:azure-storage-queue;12.7.0;12.8.0-beta.2 com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1 com.azure.spring:azure-spring-boot-starter-active-directory-b2c;3.0.0-beta.1;3.0.0-beta.2 com.azure.spring:azure-spring-boot-starter-active-directory;3.0.0-beta.1;3.0.0-beta.2 @@ -168,6 +173,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-portal;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +182,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +192,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/eng/versioning/version_data.txt b/eng/versioning/version_data.txt index 61c6a98825df..da53965c2792 100644 --- a/eng/versioning/version_data.txt +++ b/eng/versioning/version_data.txt @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1 com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4 com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1 -com.microsoft.azure:azure-servicebus;3.5.0;3.5.1 +com.microsoft.azure:azure-servicebus;3.5.1;3.6.0-beta.1 com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2 com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1 com.microsoft.azure:azure-eventgrid;1.4.0-beta.1;1.4.0-beta.1 diff --git a/pom.xml b/pom.xml index d97614e5dba3..a35230fdf3c2 100644 --- a/pom.xml +++ b/pom.xml @@ -9,17 +9,17 @@ 1.0.0 common/perf-test-core - eng/jacoco-test-coverage eng/code-quality-reports + eng/jacoco-test-coverage sdk/anomalydetector sdk/appconfiguration sdk/authorization sdk/batch sdk/boms - sdk/core - sdk/cosmos sdk/cognitiveservices sdk/communication + sdk/core + sdk/cosmos sdk/digitaltwins sdk/eventgrid sdk/eventhubs @@ -28,16 +28,18 @@ sdk/keyvault sdk/loganalytics sdk/mediaservices - sdk/monitor sdk/metricsadvisor + sdk/monitor + sdk/portal sdk/resourcemanager sdk/schemaregistry sdk/search sdk/servicebus + sdk/spring sdk/storage + sdk/synapse sdk/tables sdk/template sdk/textanalytics - sdk/spring diff --git a/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md b/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md new file mode 100644 index 000000000000..cf908aeb4d16 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-14) + +- Azure Resource Manager Portal client library for Java. This package contains Microsoft Azure SDK for Portal Management SDK. Allows creation and deletion of Azure Shared Dashboards. Package tag package-2020-09-01-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/portal/azure-resourcemanager-portal/README.md b/sdk/portal/azure-resourcemanager-portal/README.md new file mode 100644 index 000000000000..92328582d23e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/README.md @@ -0,0 +1,84 @@ +# Azure Resource Manager Portal client library for Java + +Azure Resource Manager Portal client library for Java. + +This package contains Microsoft Azure SDK for Portal Management SDK. Allows creation and deletion of Azure Shared Dashboards. Package tag package-2020-09-01-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 + +```xml + + com.azure.resourcemanager + azure-resourcemanager-portal + 1.0.0-beta.1 + +``` + +### 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: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-portal;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PortalManager manager = PortalManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +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 + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +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/portal/azure-resourcemanager-portal/pom.xml b/sdk/portal/azure-resourcemanager-portal/pom.xml new file mode 100644 index 000000000000..eb45dc23f19d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/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-portal + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Portal Management + This package contains Microsoft Azure SDK for Portal Management SDK. Allows creation and deletion of Azure Shared Dashboards. Package tag package-2020-09-01-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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/PortalManager.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/PortalManager.java new file mode 100644 index 000000000000..236c7eac35e5 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/PortalManager.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal; + +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.portal.fluent.Portal; +import com.azure.resourcemanager.portal.implementation.DashboardsImpl; +import com.azure.resourcemanager.portal.implementation.ListTenantConfigurationViolationsImpl; +import com.azure.resourcemanager.portal.implementation.OperationsImpl; +import com.azure.resourcemanager.portal.implementation.PortalBuilder; +import com.azure.resourcemanager.portal.implementation.TenantConfigurationsImpl; +import com.azure.resourcemanager.portal.models.Dashboards; +import com.azure.resourcemanager.portal.models.ListTenantConfigurationViolations; +import com.azure.resourcemanager.portal.models.Operations; +import com.azure.resourcemanager.portal.models.TenantConfigurations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to PortalManager. Allows creation and deletion of Azure Shared Dashboards. */ +public final class PortalManager { + private Operations operations; + + private Dashboards dashboards; + + private TenantConfigurations tenantConfigurations; + + private ListTenantConfigurationViolations listTenantConfigurationViolations; + + private final Portal clientObject; + + private PortalManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PortalBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Portal service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Portal service API instance. + */ + public static PortalManager 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 PortalManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PortalManager.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 Portal service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Portal service API instance. + */ + public PortalManager 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.portal", + "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 PortalManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Dashboards. */ + public Dashboards dashboards() { + if (this.dashboards == null) { + this.dashboards = new DashboardsImpl(clientObject.getDashboards(), this); + } + return dashboards; + } + + /** @return Resource collection API of TenantConfigurations. */ + public TenantConfigurations tenantConfigurations() { + if (this.tenantConfigurations == null) { + this.tenantConfigurations = new TenantConfigurationsImpl(clientObject.getTenantConfigurations(), this); + } + return tenantConfigurations; + } + + /** @return Resource collection API of ListTenantConfigurationViolations. */ + public ListTenantConfigurationViolations listTenantConfigurationViolations() { + if (this.listTenantConfigurationViolations == null) { + this.listTenantConfigurationViolations = + new ListTenantConfigurationViolationsImpl(clientObject.getListTenantConfigurationViolations(), this); + } + return listTenantConfigurationViolations; + } + + /** + * @return Wrapped service client Portal providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public Portal serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/DashboardsClient.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/DashboardsClient.java new file mode 100644 index 000000000000..8866e9c2cf5d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/DashboardsClient.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.fluent.models.DashboardInner; +import com.azure.resourcemanager.portal.models.PatchableDashboard; + +/** An instance of this class provides access to all the operations defined in DashboardsClient. */ +public interface DashboardsClient { + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DashboardInner createOrUpdate(String resourceGroupName, String dashboardName, DashboardInner dashboard); + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String dashboardName, DashboardInner dashboard, Context context); + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dashboardName); + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String dashboardName, Context context); + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DashboardInner getByResourceGroup(String resourceGroupName, String dashboardName); + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @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 Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String dashboardName, Context context); + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DashboardInner update(String resourceGroupName, String dashboardName, PatchableDashboard dashboard); + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String dashboardName, PatchableDashboard dashboard, Context context); + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/ListTenantConfigurationViolationsClient.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/ListTenantConfigurationViolationsClient.java new file mode 100644 index 000000000000..611dd1768c28 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/ListTenantConfigurationViolationsClient.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.portal.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.portal.fluent.models.ViolationInner; + +/** + * An instance of this class provides access to all the operations defined in ListTenantConfigurationViolationsClient. + */ +public interface ListTenantConfigurationViolationsClient { + /** + * Gets list of items that violate tenant's configuration. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of items that violate tenant's configuration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets list of items that violate tenant's configuration. + * + * @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 list of items that violate tenant's configuration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/OperationsClient.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/OperationsClient.java new file mode 100644 index 000000000000..ecd6b61d6a95 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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.portal.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.portal.fluent.models.ResourceProviderOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * The Microsoft Portal operations API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The Microsoft Portal operations API. + * + * @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 results of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/Portal.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/Portal.java new file mode 100644 index 000000000000..c9721117fc46 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/Portal.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for Portal class. */ +public interface Portal { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the DashboardsClient object to access its operations. + * + * @return the DashboardsClient object. + */ + DashboardsClient getDashboards(); + + /** + * Gets the TenantConfigurationsClient object to access its operations. + * + * @return the TenantConfigurationsClient object. + */ + TenantConfigurationsClient getTenantConfigurations(); + + /** + * Gets the ListTenantConfigurationViolationsClient object to access its operations. + * + * @return the ListTenantConfigurationViolationsClient object. + */ + ListTenantConfigurationViolationsClient getListTenantConfigurationViolations(); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/TenantConfigurationsClient.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/TenantConfigurationsClient.java new file mode 100644 index 000000000000..4f40bd84d75b --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/TenantConfigurationsClient.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** An instance of this class provides access to all the operations defined in TenantConfigurationsClient. */ +public interface TenantConfigurationsClient { + /** + * Gets list of the tenant configurations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets list of the tenant configurations. + * + * @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 list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner get(ConfigurationName configurationName); + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(ConfigurationName configurationName, Context context); + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner create(ConfigurationName configurationName, ConfigurationInner tenantConfiguration); + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration, Context context); + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(ConfigurationName configurationName); + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(ConfigurationName configurationName, Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationInner.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationInner.java new file mode 100644 index 000000000000..a5c4cf73cc01 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationInner.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.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Tenant configuration. */ +@JsonFlatten +@Fluent +public class ConfigurationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationInner.class); + + /* + * When flag is set to true Markdown tile will require external storage + * configuration (URI). The inline content configuration will be + * prohibited. + */ + @JsonProperty(value = "properties.enforcePrivateMarkdownStorage") + private Boolean enforcePrivateMarkdownStorage; + + /** + * Get the enforcePrivateMarkdownStorage property: When flag is set to true Markdown tile will require external + * storage configuration (URI). The inline content configuration will be prohibited. + * + * @return the enforcePrivateMarkdownStorage value. + */ + public Boolean enforcePrivateMarkdownStorage() { + return this.enforcePrivateMarkdownStorage; + } + + /** + * Set the enforcePrivateMarkdownStorage property: When flag is set to true Markdown tile will require external + * storage configuration (URI). The inline content configuration will be prohibited. + * + * @param enforcePrivateMarkdownStorage the enforcePrivateMarkdownStorage value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withEnforcePrivateMarkdownStorage(Boolean enforcePrivateMarkdownStorage) { + this.enforcePrivateMarkdownStorage = enforcePrivateMarkdownStorage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardInner.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardInner.java new file mode 100644 index 000000000000..8129f4f43a73 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The shared dashboard resource definition. */ +@JsonFlatten +@Fluent +public class DashboardInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardInner.class); + + /* + * The dashboard lenses. + */ + @JsonProperty(value = "properties.lenses") + private List lenses; + + /* + * The dashboard metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * Get the lenses property: The dashboard lenses. + * + * @return the lenses value. + */ + public List lenses() { + return this.lenses; + } + + /** + * Set the lenses property: The dashboard lenses. + * + * @param lenses the lenses value to set. + * @return the DashboardInner object itself. + */ + public DashboardInner withLenses(List lenses) { + this.lenses = lenses; + return this; + } + + /** + * Get the metadata property: The dashboard metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The dashboard metadata. + * + * @param metadata the metadata value to set. + * @return the DashboardInner object itself. + */ + public DashboardInner withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** {@inheritDoc} */ + @Override + public DashboardInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DashboardInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lenses() != null) { + lenses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ResourceProviderOperationInner.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ResourceProviderOperationInner.java new file mode 100644 index 000000000000..a49babe71109 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ResourceProviderOperationInner.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.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported operations of this resource provider. */ +@Fluent +public final class ResourceProviderOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationInner.class); + + /* + * Operation name, in format of {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation applies to data-plane. + */ + @JsonProperty(value = "isDataAction") + private String isDataAction; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + public String isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @param isDataAction the isDataAction value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withIsDataAction(String isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ViolationInner.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ViolationInner.java new file mode 100644 index 000000000000..b0b248fd765c --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ViolationInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.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; + +/** Violation information. */ +@Immutable +public final class ViolationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ViolationInner.class); + + /* + * Id of the item that violates tenant configuration. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Id of the user who owns violated item. + */ + @JsonProperty(value = "userId", access = JsonProperty.Access.WRITE_ONLY) + private String userId; + + /* + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get the id property: Id of the item that violates tenant configuration. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the userId property: Id of the user who owns violated item. + * + * @return the userId value. + */ + public String userId() { + return this.userId; + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/package-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/package-info.java new file mode 100644 index 000000000000..168e03466d5e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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 Portal. Allows creation and deletion of Azure Shared Dashboards. */ +package com.azure.resourcemanager.portal.fluent.models; diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/package-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/package-info.java new file mode 100644 index 000000000000..6fe57382cadd --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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 Portal. Allows creation and deletion of Azure Shared Dashboards. */ +package com.azure.resourcemanager.portal.fluent; diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ConfigurationImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ConfigurationImpl.java new file mode 100644 index 000000000000..0617b5a69e3d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ConfigurationImpl.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.portal.implementation; + +import com.azure.resourcemanager.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.Configuration; + +public final class ConfigurationImpl implements Configuration { + private ConfigurationInner innerObject; + + private final PortalManager serviceManager; + + public ConfigurationImpl(ConfigurationInner innerObject, PortalManager 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 Boolean enforcePrivateMarkdownStorage() { + return this.innerModel().enforcePrivateMarkdownStorage(); + } + + public ConfigurationInner innerModel() { + return this.innerObject; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardImpl.java new file mode 100644 index 000000000000..24f44b9517e6 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import com.azure.resourcemanager.portal.models.Dashboard; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.azure.resourcemanager.portal.models.PatchableDashboard; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DashboardImpl implements Dashboard, Dashboard.Definition, Dashboard.Update { + private DashboardInner innerObject; + + private final PortalManager 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 List lenses() { + List inner = this.innerModel().lenses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map metadata() { + Map inner = this.innerModel().metadata(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DashboardInner innerModel() { + return this.innerObject; + } + + private PortalManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dashboardName; + + private PatchableDashboard updateDashboard; + + public DashboardImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Dashboard create() { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .createOrUpdateWithResponse(resourceGroupName, dashboardName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Dashboard create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .createOrUpdateWithResponse(resourceGroupName, dashboardName, this.innerModel(), context) + .getValue(); + return this; + } + + public DashboardImpl(String name, PortalManager serviceManager) { + this.innerObject = new DashboardInner(); + this.serviceManager = serviceManager; + this.dashboardName = name; + } + + public DashboardImpl update() { + this.updateDashboard = new PatchableDashboard(); + return this; + } + + public Dashboard apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .updateWithResponse(resourceGroupName, dashboardName, updateDashboard, Context.NONE) + .getValue(); + return this; + } + + public Dashboard apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .updateWithResponse(resourceGroupName, dashboardName, updateDashboard, context) + .getValue(); + return this; + } + + public DashboardImpl(DashboardInner innerObject, PortalManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dashboardName = Utils.getValueFromIdByName(innerObject.id(), "dashboards"); + } + + public Dashboard refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .getByResourceGroupWithResponse(resourceGroupName, dashboardName, Context.NONE) + .getValue(); + return this; + } + + public Dashboard refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDashboards() + .getByResourceGroupWithResponse(resourceGroupName, dashboardName, context) + .getValue(); + return this; + } + + public DashboardImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DashboardImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DashboardImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDashboard.withTags(tags); + return this; + } + } + + public DashboardImpl withLenses(List lenses) { + if (isInCreateMode()) { + this.innerModel().withLenses(lenses); + return this; + } else { + this.updateDashboard.withLenses(lenses); + return this; + } + } + + public DashboardImpl withMetadata(Map metadata) { + if (isInCreateMode()) { + this.innerModel().withMetadata(metadata); + return this; + } else { + this.updateDashboard.withMetadata(metadata); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsClientImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsClientImpl.java new file mode 100644 index 000000000000..71a2655dbf24 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsClientImpl.java @@ -0,0 +1,1243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.DashboardsClient; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import com.azure.resourcemanager.portal.models.DashboardListResult; +import com.azure.resourcemanager.portal.models.PatchableDashboard; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DashboardsClient. */ +public final class DashboardsClientImpl implements DashboardsClient { + private final ClientLogger logger = new ClientLogger(DashboardsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DashboardsService service; + + /** The service client containing this operation class. */ + private final PortalImpl client; + + /** + * Initializes an instance of DashboardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DashboardsClientImpl(PortalImpl client) { + this.service = + RestProxy.create(DashboardsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PortalDashboards to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PortalDashboards") + private interface DashboardsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards" + + "/{dashboardName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dashboardName") String dashboardName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DashboardInner dashboard, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards" + + "/{dashboardName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dashboardName") String dashboardName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards" + + "/{dashboardName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dashboardName") String dashboardName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards" + + "/{dashboardName}") + @ExpectedResponses({200, 404}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dashboardName") String dashboardName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchableDashboard dashboard, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Portal/dashboards") + @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}/providers/Microsoft.Portal/dashboards") + @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("{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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String dashboardName, DashboardInner dashboard) { + 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + if (dashboard == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboard is required and cannot be null.")); + } else { + dashboard.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + dashboard, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String dashboardName, DashboardInner dashboard, 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + if (dashboard == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboard is required and cannot be null.")); + } else { + dashboard.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + dashboard, + accept, + context); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String dashboardName, DashboardInner dashboard) { + return createOrUpdateWithResponseAsync(resourceGroupName, dashboardName, dashboard) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DashboardInner createOrUpdate(String resourceGroupName, String dashboardName, DashboardInner dashboard) { + return createOrUpdateAsync(resourceGroupName, dashboardName, dashboard).block(); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String dashboardName, DashboardInner dashboard, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, dashboardName, dashboard, context).block(); + } + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 dashboardName) { + 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @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 dashboardName, 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName 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, + dashboardName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 dashboardName) { + return deleteWithResponseAsync(resourceGroupName, dashboardName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 dashboardName) { + deleteAsync(resourceGroupName, dashboardName).block(); + } + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String dashboardName, Context context) { + return deleteWithResponseAsync(resourceGroupName, dashboardName, context).block(); + } + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dashboardName) { + 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @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 Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dashboardName, 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName 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, + dashboardName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String dashboardName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dashboardName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DashboardInner getByResourceGroup(String resourceGroupName, String dashboardName) { + return getByResourceGroupAsync(resourceGroupName, dashboardName).block(); + } + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @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 Dashboard. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dashboardName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dashboardName, context).block(); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dashboardName, PatchableDashboard dashboard) { + 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + if (dashboard == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboard is required and cannot be null.")); + } else { + dashboard.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + dashboard, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dashboardName, PatchableDashboard dashboard, 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 (dashboardName == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboardName is required and cannot be null.")); + } + if (dashboard == null) { + return Mono.error(new IllegalArgumentException("Parameter dashboard is required and cannot be null.")); + } else { + dashboard.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dashboardName, + this.client.getApiVersion(), + dashboard, + accept, + context); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String dashboardName, PatchableDashboard dashboard) { + return updateWithResponseAsync(resourceGroupName, dashboardName, dashboard) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DashboardInner update(String resourceGroupName, String dashboardName, PatchableDashboard dashboard) { + return updateAsync(resourceGroupName, dashboardName, dashboard).block(); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The shared dashboard resource definition. + * @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 shared dashboard resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String dashboardName, PatchableDashboard dashboard, Context context) { + return updateWithResponseAsync(resourceGroupName, dashboardName, dashboard, context).block(); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the Dashboards within a resource group. + */ + @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()))); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 all the Dashboards within a resource group. + */ + @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)); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 all the Dashboards within a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @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()))); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @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)); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + @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 list of dashboards. + */ + @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 list of dashboards. + */ + @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)); + } + + /** + * 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 list of dashboards. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of dashboards. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsImpl.java new file mode 100644 index 000000000000..05964f90291d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.DashboardsClient; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import com.azure.resourcemanager.portal.models.Dashboard; +import com.azure.resourcemanager.portal.models.Dashboards; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DashboardsImpl implements Dashboards { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardsImpl.class); + + private final DashboardsClient innerClient; + + private final PortalManager serviceManager; + + public DashboardsImpl(DashboardsClient innerClient, PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String dashboardName) { + this.serviceClient().delete(resourceGroupName, dashboardName); + } + + public Response deleteWithResponse(String resourceGroupName, String dashboardName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, dashboardName, context); + } + + public Dashboard getByResourceGroup(String resourceGroupName, String dashboardName) { + DashboardInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, dashboardName); + if (inner != null) { + return new DashboardImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dashboardName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dashboardName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DashboardImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public Dashboard 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 dashboardName = Utils.getValueFromIdByName(id, "dashboards"); + if (dashboardName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dashboards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, dashboardName, 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 dashboardName = Utils.getValueFromIdByName(id, "dashboards"); + if (dashboardName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dashboards'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, dashboardName, 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 dashboardName = Utils.getValueFromIdByName(id, "dashboards"); + if (dashboardName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dashboards'.", id))); + } + this.deleteWithResponse(resourceGroupName, dashboardName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dashboardName = Utils.getValueFromIdByName(id, "dashboards"); + if (dashboardName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dashboards'.", id))); + } + return this.deleteWithResponse(resourceGroupName, dashboardName, context); + } + + private DashboardsClient serviceClient() { + return this.innerClient; + } + + private PortalManager manager() { + return this.serviceManager; + } + + public DashboardImpl define(String name) { + return new DashboardImpl(name, this.manager()); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsClientImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsClientImpl.java new file mode 100644 index 000000000000..aeb291068247 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.fluent.ListTenantConfigurationViolationsClient; +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; +import com.azure.resourcemanager.portal.models.ViolationsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ListTenantConfigurationViolationsClient. + */ +public final class ListTenantConfigurationViolationsClientImpl implements ListTenantConfigurationViolationsClient { + private final ClientLogger logger = new ClientLogger(ListTenantConfigurationViolationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ListTenantConfigurationViolationsService service; + + /** The service client containing this operation class. */ + private final PortalImpl client; + + /** + * Initializes an instance of ListTenantConfigurationViolationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ListTenantConfigurationViolationsClientImpl(PortalImpl client) { + this.service = + RestProxy + .create( + ListTenantConfigurationViolationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PortalListTenantConfigurationViolations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PortalListTenantConf") + private interface ListTenantConfigurationViolationsService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Portal/listTenantConfigurationViolations") + @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); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of items that violate tenant's configuration. + */ + @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()))); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @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 list of items that violate tenant's configuration. + */ + @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)); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of items that violate tenant's configuration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @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 list of items that violate tenant's configuration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of items that violate tenant's configuration. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets list of items that violate tenant's configuration. + * + * @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 list of items that violate tenant's configuration. + */ + @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 list of list of items that violate tenant's configuration. + */ + @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 list of list of items that violate tenant's configuration. + */ + @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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsImpl.java new file mode 100644 index 000000000000..5a4634f2313f --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsImpl.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.portal.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.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.ListTenantConfigurationViolationsClient; +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; +import com.azure.resourcemanager.portal.models.ListTenantConfigurationViolations; +import com.azure.resourcemanager.portal.models.Violation; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ListTenantConfigurationViolationsImpl implements ListTenantConfigurationViolations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListTenantConfigurationViolationsImpl.class); + + private final ListTenantConfigurationViolationsClient innerClient; + + private final PortalManager serviceManager; + + public ListTenantConfigurationViolationsImpl( + ListTenantConfigurationViolationsClient innerClient, PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ViolationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ViolationImpl(inner1, this.manager())); + } + + private ListTenantConfigurationViolationsClient serviceClient() { + return this.innerClient; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsClientImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..6b72215ebced --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.fluent.OperationsClient; +import com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.portal.models.ResourceProviderOperationList; +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 PortalImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PortalImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PortalOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PortalOperations") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Portal/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); + } + + /** + * The Microsoft Portal operations API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations. + */ + @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()))); + } + + /** + * The Microsoft Portal operations API. + * + * @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 results of the request to list operations. + */ + @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)); + } + + /** + * The Microsoft Portal operations API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The Microsoft Portal operations API. + * + * @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 results of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The Microsoft Portal operations API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * The Microsoft Portal operations API. + * + * @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 results of the request to list operations. + */ + @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 results of the request to list operations. + */ + @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 results of the request to list operations. + */ + @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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsImpl.java new file mode 100644 index 000000000000..eb6dcd3493a8 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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.portal.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.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.OperationsClient; +import com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.portal.models.Operations; +import com.azure.resourcemanager.portal.models.ResourceProviderOperation; +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 PortalManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalBuilder.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalBuilder.java new file mode 100644 index 000000000000..ea019e4598c0 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalBuilder.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.portal.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 PortalImpl type. */ +@ServiceClientBuilder(serviceClients = {PortalImpl.class}) +public final class PortalBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the PortalBuilder. + */ + public PortalBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PortalBuilder. + */ + public PortalBuilder 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 PortalBuilder. + */ + public PortalBuilder 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 PortalBuilder. + */ + public PortalBuilder 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 PortalBuilder. + */ + public PortalBuilder 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 PortalBuilder. + */ + public PortalBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PortalImpl with the provided parameters. + * + * @return an instance of PortalImpl. + */ + public PortalImpl 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(); + } + PortalImpl client = + new PortalImpl(pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalImpl.java new file mode 100644 index 000000000000..16d7bd1ed69d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalImpl.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.portal.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.portal.fluent.DashboardsClient; +import com.azure.resourcemanager.portal.fluent.ListTenantConfigurationViolationsClient; +import com.azure.resourcemanager.portal.fluent.OperationsClient; +import com.azure.resourcemanager.portal.fluent.Portal; +import com.azure.resourcemanager.portal.fluent.TenantConfigurationsClient; +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 PortalImpl type. */ +@ServiceClient(builder = PortalBuilder.class) +public final class PortalImpl implements Portal { + private final ClientLogger logger = new ClientLogger(PortalImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The DashboardsClient object to access its operations. */ + private final DashboardsClient dashboards; + + /** + * Gets the DashboardsClient object to access its operations. + * + * @return the DashboardsClient object. + */ + public DashboardsClient getDashboards() { + return this.dashboards; + } + + /** The TenantConfigurationsClient object to access its operations. */ + private final TenantConfigurationsClient tenantConfigurations; + + /** + * Gets the TenantConfigurationsClient object to access its operations. + * + * @return the TenantConfigurationsClient object. + */ + public TenantConfigurationsClient getTenantConfigurations() { + return this.tenantConfigurations; + } + + /** The ListTenantConfigurationViolationsClient object to access its operations. */ + private final ListTenantConfigurationViolationsClient listTenantConfigurationViolations; + + /** + * Gets the ListTenantConfigurationViolationsClient object to access its operations. + * + * @return the ListTenantConfigurationViolationsClient object. + */ + public ListTenantConfigurationViolationsClient getListTenantConfigurationViolations() { + return this.listTenantConfigurationViolations; + } + + /** + * Initializes an instance of Portal client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + PortalImpl( + 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-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.dashboards = new DashboardsClientImpl(this); + this.tenantConfigurations = new TenantConfigurationsClientImpl(this); + this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsClientImpl(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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ResourceProviderOperationImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ResourceProviderOperationImpl.java new file mode 100644 index 000000000000..ce5bb39b224b --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ResourceProviderOperationImpl.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.portal.implementation; + +import com.azure.resourcemanager.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.portal.models.ResourceProviderOperation; +import com.azure.resourcemanager.portal.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationImpl implements ResourceProviderOperation { + private ResourceProviderOperationInner innerObject; + + private final PortalManager serviceManager; + + public ResourceProviderOperationImpl(ResourceProviderOperationInner innerObject, PortalManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String isDataAction() { + return this.innerModel().isDataAction(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationInner innerModel() { + return this.innerObject; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsClientImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsClientImpl.java new file mode 100644 index 000000000000..992284507acd --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsClientImpl.java @@ -0,0 +1,666 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.TenantConfigurationsClient; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.ConfigurationList; +import com.azure.resourcemanager.portal.models.ConfigurationName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TenantConfigurationsClient. */ +public final class TenantConfigurationsClientImpl implements TenantConfigurationsClient { + private final ClientLogger logger = new ClientLogger(TenantConfigurationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TenantConfigurationsService service; + + /** The service client containing this operation class. */ + private final PortalImpl client; + + /** + * Initializes an instance of TenantConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TenantConfigurationsClientImpl(PortalImpl client) { + this.service = + RestProxy + .create(TenantConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PortalTenantConfigurations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PortalTenantConfigur") + private interface TenantConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Portal/tenantConfigurations") + @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("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("configurationName") ConfigurationName configurationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("configurationName") ConfigurationName configurationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ConfigurationInner tenantConfiguration, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/providers/Microsoft.Portal/tenantConfigurations/{configurationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("configurationName") ConfigurationName 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); + } + + /** + * Gets list of the tenant configurations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the tenant configurations. + */ + @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()))); + } + + /** + * Gets list of the tenant configurations. + * + * @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 list of the tenant configurations. + */ + @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)); + } + + /** + * Gets list of the tenant configurations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets list of the tenant configurations. + * + * @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 list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets list of the tenant configurations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets list of the tenant configurations. + * + * @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 list of the tenant configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(ConfigurationName configurationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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(), configurationName, this.client.getApiVersion(), accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + ConfigurationName configurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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(), configurationName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(ConfigurationName configurationName) { + return getWithResponseAsync(configurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner get(ConfigurationName configurationName) { + return getAsync(configurationName).block(); + } + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(ConfigurationName configurationName, Context context) { + return getWithResponseAsync(configurationName, context).block(); + } + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (tenantConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantConfiguration is required and cannot be null.")); + } else { + tenantConfiguration.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + configurationName, + this.client.getApiVersion(), + tenantConfiguration, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (tenantConfiguration == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantConfiguration is required and cannot be null.")); + } else { + tenantConfiguration.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + configurationName, + this.client.getApiVersion(), + tenantConfiguration, + accept, + context); + } + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration) { + return createWithResponseAsync(configurationName, tenantConfiguration) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner create(ConfigurationName configurationName, ConfigurationInner tenantConfiguration) { + return createAsync(configurationName, tenantConfiguration).block(); + } + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @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 tenant configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration, Context context) { + return createWithResponseAsync(configurationName, tenantConfiguration, context).block(); + } + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(ConfigurationName configurationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 + .delete( + this.client.getEndpoint(), configurationName, this.client.getApiVersion(), accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @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(ConfigurationName configurationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 + .delete(this.client.getEndpoint(), configurationName, this.client.getApiVersion(), accept, context); + } + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(ConfigurationName configurationName) { + return deleteWithResponseAsync(configurationName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(ConfigurationName configurationName) { + deleteAsync(configurationName).block(); + } + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(ConfigurationName configurationName, Context context) { + return deleteWithResponseAsync(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 list of tenant configurations. + */ + @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 list of tenant configurations. + */ + @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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsImpl.java new file mode 100644 index 000000000000..94ad4b148463 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsImpl.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.TenantConfigurationsClient; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.Configuration; +import com.azure.resourcemanager.portal.models.ConfigurationName; +import com.azure.resourcemanager.portal.models.TenantConfigurations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TenantConfigurationsImpl implements TenantConfigurations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TenantConfigurationsImpl.class); + + private final TenantConfigurationsClient innerClient; + + private final PortalManager serviceManager; + + public TenantConfigurationsImpl(TenantConfigurationsClient innerClient, PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public Configuration get(ConfigurationName configurationName) { + ConfigurationInner inner = this.serviceClient().get(configurationName); + if (inner != null) { + return new ConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(ConfigurationName configurationName, Context context) { + Response inner = this.serviceClient().getWithResponse(configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Configuration create(ConfigurationName configurationName, ConfigurationInner tenantConfiguration) { + ConfigurationInner inner = this.serviceClient().create(configurationName, tenantConfiguration); + if (inner != null) { + return new ConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createWithResponse( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration, Context context) { + Response inner = + this.serviceClient().createWithResponse(configurationName, tenantConfiguration, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(ConfigurationName configurationName) { + this.serviceClient().delete(configurationName); + } + + public Response deleteWithResponse(ConfigurationName configurationName, Context context) { + return this.serviceClient().deleteWithResponse(configurationName, context); + } + + private TenantConfigurationsClient serviceClient() { + return this.innerClient; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/Utils.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/Utils.java new file mode 100644 index 000000000000..1041a408c9ff --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/Utils.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.portal.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.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; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ViolationImpl.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ViolationImpl.java new file mode 100644 index 000000000000..d3e2d11223d8 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ViolationImpl.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.portal.implementation; + +import com.azure.resourcemanager.portal.PortalManager; +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; +import com.azure.resourcemanager.portal.models.Violation; + +public final class ViolationImpl implements Violation { + private ViolationInner innerObject; + + private final PortalManager serviceManager; + + public ViolationImpl(ViolationInner innerObject, PortalManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String userId() { + return this.innerModel().userId(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public ViolationInner innerModel() { + return this.innerObject; + } + + private PortalManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/package-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/package-info.java new file mode 100644 index 000000000000..98ac759318ad --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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 Portal. Allows creation and deletion of Azure Shared Dashboards. */ +package com.azure.resourcemanager.portal.implementation; diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Configuration.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Configuration.java new file mode 100644 index 000000000000..588d85b385ca --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Configuration.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.portal.models; + +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; + +/** An immutable client-side representation of Configuration. */ +public interface Configuration { + /** + * 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 enforcePrivateMarkdownStorage property: When flag is set to true Markdown tile will require external + * storage configuration (URI). The inline content configuration will be prohibited. + * + * @return the enforcePrivateMarkdownStorage value. + */ + Boolean enforcePrivateMarkdownStorage(); + + /** + * Gets the inner com.azure.resourcemanager.portal.fluent.models.ConfigurationInner object. + * + * @return the inner object. + */ + ConfigurationInner innerModel(); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationList.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationList.java new file mode 100644 index 000000000000..e01755328d6e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationList.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.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of tenant configurations. */ +@Fluent +public final class ConfigurationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationList.class); + + /* + * The array of tenant configurations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of tenant configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of tenant configurations. + * + * @param value the value value to set. + * @return the ConfigurationList object itself. + */ + public ConfigurationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ConfigurationList object itself. + */ + public ConfigurationList 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationName.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationName.java new file mode 100644 index 000000000000..2baf60d89dca --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationName.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.portal.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConfigurationName. */ +public final class ConfigurationName extends ExpandableStringEnum { + /** Static value default for ConfigurationName. */ + public static final ConfigurationName DEFAULT = fromString("default"); + + /** + * Creates or finds a ConfigurationName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfigurationName. + */ + @JsonCreator + public static ConfigurationName fromString(String name) { + return fromString(name, ConfigurationName.class); + } + + /** @return known ConfigurationName values. */ + public static Collection values() { + return values(ConfigurationName.class); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboard.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboard.java new file mode 100644 index 000000000000..a351aa3811f1 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboard.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.portal.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Dashboard. */ +public interface Dashboard { + /** + * 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 lenses property: The dashboard lenses. + * + * @return the lenses value. + */ + List lenses(); + + /** + * Gets the metadata property: The dashboard metadata. + * + * @return the metadata value. + */ + Map metadata(); + + /** + * 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.portal.fluent.models.DashboardInner object. + * + * @return the inner object. + */ + DashboardInner innerModel(); + + /** The entirety of the Dashboard definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Dashboard definition stages. */ + interface DefinitionStages { + /** The first stage of the Dashboard definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Dashboard 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 Dashboard definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Dashboard 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.WithLenses, DefinitionStages.WithMetadata { + /** + * Executes the create request. + * + * @return the created resource. + */ + Dashboard create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Dashboard create(Context context); + } + /** The stage of the Dashboard 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 Dashboard definition allowing to specify lenses. */ + interface WithLenses { + /** + * Specifies the lenses property: The dashboard lenses.. + * + * @param lenses The dashboard lenses. + * @return the next definition stage. + */ + WithCreate withLenses(List lenses); + } + /** The stage of the Dashboard definition allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: The dashboard metadata.. + * + * @param metadata The dashboard metadata. + * @return the next definition stage. + */ + WithCreate withMetadata(Map metadata); + } + } + /** + * Begins update for the Dashboard resource. + * + * @return the stage of resource update. + */ + Dashboard.Update update(); + + /** The template for Dashboard update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithLenses, UpdateStages.WithMetadata { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Dashboard apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Dashboard apply(Context context); + } + /** The Dashboard update stages. */ + interface UpdateStages { + /** The stage of the Dashboard update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Dashboard update allowing to specify lenses. */ + interface WithLenses { + /** + * Specifies the lenses property: The dashboard lenses.. + * + * @param lenses The dashboard lenses. + * @return the next definition stage. + */ + Update withLenses(List lenses); + } + /** The stage of the Dashboard update allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: The dashboard metadata.. + * + * @param metadata The dashboard metadata. + * @return the next definition stage. + */ + Update withMetadata(Map metadata); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Dashboard refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Dashboard refresh(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardLens.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardLens.java new file mode 100644 index 000000000000..9fea32f38a49 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardLens.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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; +import java.util.Map; + +/** A dashboard lens. */ +@Fluent +public final class DashboardLens { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardLens.class); + + /* + * The lens order. + */ + @JsonProperty(value = "order", required = true) + private int order; + + /* + * The dashboard parts. + */ + @JsonProperty(value = "parts", required = true) + private List parts; + + /* + * The dashboard len's metadata. + */ + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Get the order property: The lens order. + * + * @return the order value. + */ + public int order() { + return this.order; + } + + /** + * Set the order property: The lens order. + * + * @param order the order value to set. + * @return the DashboardLens object itself. + */ + public DashboardLens withOrder(int order) { + this.order = order; + return this; + } + + /** + * Get the parts property: The dashboard parts. + * + * @return the parts value. + */ + public List parts() { + return this.parts; + } + + /** + * Set the parts property: The dashboard parts. + * + * @param parts the parts value to set. + * @return the DashboardLens object itself. + */ + public DashboardLens withParts(List parts) { + this.parts = parts; + return this; + } + + /** + * Get the metadata property: The dashboard len's metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The dashboard len's metadata. + * + * @param metadata the metadata value to set. + * @return the DashboardLens object itself. + */ + public DashboardLens withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parts() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property parts in model DashboardLens")); + } else { + parts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardListResult.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardListResult.java new file mode 100644 index 000000000000..e7f01420fc22 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardListResult.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.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of dashboards. */ +@Fluent +public final class DashboardListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardListResult.class); + + /* + * The array of custom resource provider manifests. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of custom resource provider manifests. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of custom resource provider manifests. + * + * @param value the value value to set. + * @return the DashboardListResult object itself. + */ + public DashboardListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DashboardListResult object itself. + */ + public DashboardListResult 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartMetadata.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartMetadata.java new file mode 100644 index 000000000000..101eae3cfdad --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartMetadata.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A dashboard part metadata. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = DashboardPartMetadata.class) +@JsonTypeName("DashboardPartMetadata") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Extension/HubsExtension/PartType/MarkdownPart", value = MarkdownPartMetadata.class) +}) +@Immutable +public class DashboardPartMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardPartMetadata.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardParts.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardParts.java new file mode 100644 index 000000000000..b22feb8dc8e0 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardParts.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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; + +/** A dashboard part. */ +@Fluent +public final class DashboardParts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardParts.class); + + /* + * The dashboard's part position. + */ + @JsonProperty(value = "position", required = true) + private DashboardPartsPosition position; + + /* + * The dashboard part's metadata. + */ + @JsonProperty(value = "metadata") + private DashboardPartMetadata metadata; + + /** + * Get the position property: The dashboard's part position. + * + * @return the position value. + */ + public DashboardPartsPosition position() { + return this.position; + } + + /** + * Set the position property: The dashboard's part position. + * + * @param position the position value to set. + * @return the DashboardParts object itself. + */ + public DashboardParts withPosition(DashboardPartsPosition position) { + this.position = position; + return this; + } + + /** + * Get the metadata property: The dashboard part's metadata. + * + * @return the metadata value. + */ + public DashboardPartMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The dashboard part's metadata. + * + * @param metadata the metadata value to set. + * @return the DashboardParts object itself. + */ + public DashboardParts withMetadata(DashboardPartMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (position() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property position in model DashboardParts")); + } else { + position().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartsPosition.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartsPosition.java new file mode 100644 index 000000000000..dcdc9bf35db4 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartsPosition.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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 dashboard's part position. */ +@Fluent +public final class DashboardPartsPosition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DashboardPartsPosition.class); + + /* + * The dashboard's part x coordinate. + */ + @JsonProperty(value = "x", required = true) + private int x; + + /* + * The dashboard's part y coordinate. + */ + @JsonProperty(value = "y", required = true) + private int y; + + /* + * The dashboard's part row span. + */ + @JsonProperty(value = "rowSpan", required = true) + private int rowSpan; + + /* + * The dashboard's part column span. + */ + @JsonProperty(value = "colSpan", required = true) + private int colSpan; + + /* + * The dashboard part's metadata. + */ + @JsonProperty(value = "metadata") + private Map metadata; + + /** + * Get the x property: The dashboard's part x coordinate. + * + * @return the x value. + */ + public int x() { + return this.x; + } + + /** + * Set the x property: The dashboard's part x coordinate. + * + * @param x the x value to set. + * @return the DashboardPartsPosition object itself. + */ + public DashboardPartsPosition withX(int x) { + this.x = x; + return this; + } + + /** + * Get the y property: The dashboard's part y coordinate. + * + * @return the y value. + */ + public int y() { + return this.y; + } + + /** + * Set the y property: The dashboard's part y coordinate. + * + * @param y the y value to set. + * @return the DashboardPartsPosition object itself. + */ + public DashboardPartsPosition withY(int y) { + this.y = y; + return this; + } + + /** + * Get the rowSpan property: The dashboard's part row span. + * + * @return the rowSpan value. + */ + public int rowSpan() { + return this.rowSpan; + } + + /** + * Set the rowSpan property: The dashboard's part row span. + * + * @param rowSpan the rowSpan value to set. + * @return the DashboardPartsPosition object itself. + */ + public DashboardPartsPosition withRowSpan(int rowSpan) { + this.rowSpan = rowSpan; + return this; + } + + /** + * Get the colSpan property: The dashboard's part column span. + * + * @return the colSpan value. + */ + public int colSpan() { + return this.colSpan; + } + + /** + * Set the colSpan property: The dashboard's part column span. + * + * @param colSpan the colSpan value to set. + * @return the DashboardPartsPosition object itself. + */ + public DashboardPartsPosition withColSpan(int colSpan) { + this.colSpan = colSpan; + return this; + } + + /** + * Get the metadata property: The dashboard part's metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The dashboard part's metadata. + * + * @param metadata the metadata value to set. + * @return the DashboardPartsPosition object itself. + */ + public DashboardPartsPosition withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboards.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboards.java new file mode 100644 index 000000000000..529eb1b12190 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboards.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.portal.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 Dashboards. */ +public interface Dashboards { + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 dashboardName); + + /** + * Deletes the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String dashboardName, Context context); + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Dashboard. + */ + Dashboard getByResourceGroup(String resourceGroupName, String dashboardName); + + /** + * Gets the Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @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 Dashboard. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String dashboardName, Context context); + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the Dashboards within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the Dashboards within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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 all the Dashboards within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + PagedIterable list(); + + /** + * Gets all the dashboards within a 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 all the dashboards within a subscription. + */ + PagedIterable list(Context context); + + /** + * Gets the Dashboard. + * + * @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 Dashboard. + */ + Dashboard getById(String id); + + /** + * Gets the Dashboard. + * + * @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 Dashboard. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the Dashboard. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the Dashboard. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Dashboard resource. + * + * @param name resource name. + * @return the first stage of the new Dashboard definition. + */ + Dashboard.DefinitionStages.Blank define(String name); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ListTenantConfigurationViolations.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ListTenantConfigurationViolations.java new file mode 100644 index 000000000000..4b9c1a215159 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ListTenantConfigurationViolations.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.portal.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ListTenantConfigurationViolations. */ +public interface ListTenantConfigurationViolations { + /** + * Gets list of items that violate tenant's configuration. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of items that violate tenant's configuration. + */ + PagedIterable list(); + + /** + * Gets list of items that violate tenant's configuration. + * + * @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 list of items that violate tenant's configuration. + */ + PagedIterable list(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadata.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadata.java new file mode 100644 index 000000000000..8a5356e9dbe1 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadata.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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 com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Markdown part metadata. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Extension/HubsExtension/PartType/MarkdownPart") +@Fluent +public final class MarkdownPartMetadata extends DashboardPartMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarkdownPartMetadata.class); + + /* + * Input to dashboard part. + */ + @JsonProperty(value = "inputs") + private List inputs; + + /* + * Markdown part settings. + */ + @JsonProperty(value = "settings") + private MarkdownPartMetadataSettings settings; + + /** + * Get the inputs property: Input to dashboard part. + * + * @return the inputs value. + */ + public List inputs() { + return this.inputs; + } + + /** + * Set the inputs property: Input to dashboard part. + * + * @param inputs the inputs value to set. + * @return the MarkdownPartMetadata object itself. + */ + public MarkdownPartMetadata withInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Get the settings property: Markdown part settings. + * + * @return the settings value. + */ + public MarkdownPartMetadataSettings settings() { + return this.settings; + } + + /** + * Set the settings property: Markdown part settings. + * + * @param settings the settings value to set. + * @return the MarkdownPartMetadata object itself. + */ + public MarkdownPartMetadata withSettings(MarkdownPartMetadataSettings settings) { + this.settings = settings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (settings() != null) { + settings().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettings.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettings.java new file mode 100644 index 000000000000..8cf0f029aded --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettings.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.portal.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; + +/** Markdown part settings. */ +@Fluent +public final class MarkdownPartMetadataSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarkdownPartMetadataSettings.class); + + /* + * The content of markdown part. + */ + @JsonProperty(value = "content") + private MarkdownPartMetadataSettingsContent content; + + /** + * Get the content property: The content of markdown part. + * + * @return the content value. + */ + public MarkdownPartMetadataSettingsContent content() { + return this.content; + } + + /** + * Set the content property: The content of markdown part. + * + * @param content the content value to set. + * @return the MarkdownPartMetadataSettings object itself. + */ + public MarkdownPartMetadataSettings withContent(MarkdownPartMetadataSettingsContent content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (content() != null) { + content().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContent.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContent.java new file mode 100644 index 000000000000..9c9cb63be760 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContent.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.portal.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 content of markdown part. */ +@Fluent +public final class MarkdownPartMetadataSettingsContent { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarkdownPartMetadataSettingsContent.class); + + /* + * The setting of the content of markdown part. + */ + @JsonProperty(value = "settings") + private MarkdownPartMetadataSettingsContentSettings settings; + + /** + * Get the settings property: The setting of the content of markdown part. + * + * @return the settings value. + */ + public MarkdownPartMetadataSettingsContentSettings settings() { + return this.settings; + } + + /** + * Set the settings property: The setting of the content of markdown part. + * + * @param settings the settings value to set. + * @return the MarkdownPartMetadataSettingsContent object itself. + */ + public MarkdownPartMetadataSettingsContent withSettings(MarkdownPartMetadataSettingsContentSettings settings) { + this.settings = settings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (settings() != null) { + settings().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContentSettings.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContentSettings.java new file mode 100644 index 000000000000..9f03b0573456 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContentSettings.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.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 setting of the content of markdown part. */ +@Fluent +public final class MarkdownPartMetadataSettingsContentSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarkdownPartMetadataSettingsContentSettings.class); + + /* + * The content of the markdown part. + */ + @JsonProperty(value = "content") + private String content; + + /* + * The title of the markdown part. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The subtitle of the markdown part. + */ + @JsonProperty(value = "subtitle") + private String subtitle; + + /* + * The source of the content of the markdown part. + */ + @JsonProperty(value = "markdownSource") + private Integer markdownSource; + + /* + * The uri of markdown content. + */ + @JsonProperty(value = "markdownUri") + private String markdownUri; + + /** + * Get the content property: The content of the markdown part. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The content of the markdown part. + * + * @param content the content value to set. + * @return the MarkdownPartMetadataSettingsContentSettings object itself. + */ + public MarkdownPartMetadataSettingsContentSettings withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the title property: The title of the markdown part. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The title of the markdown part. + * + * @param title the title value to set. + * @return the MarkdownPartMetadataSettingsContentSettings object itself. + */ + public MarkdownPartMetadataSettingsContentSettings withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the subtitle property: The subtitle of the markdown part. + * + * @return the subtitle value. + */ + public String subtitle() { + return this.subtitle; + } + + /** + * Set the subtitle property: The subtitle of the markdown part. + * + * @param subtitle the subtitle value to set. + * @return the MarkdownPartMetadataSettingsContentSettings object itself. + */ + public MarkdownPartMetadataSettingsContentSettings withSubtitle(String subtitle) { + this.subtitle = subtitle; + return this; + } + + /** + * Get the markdownSource property: The source of the content of the markdown part. + * + * @return the markdownSource value. + */ + public Integer markdownSource() { + return this.markdownSource; + } + + /** + * Set the markdownSource property: The source of the content of the markdown part. + * + * @param markdownSource the markdownSource value to set. + * @return the MarkdownPartMetadataSettingsContentSettings object itself. + */ + public MarkdownPartMetadataSettingsContentSettings withMarkdownSource(Integer markdownSource) { + this.markdownSource = markdownSource; + return this; + } + + /** + * Get the markdownUri property: The uri of markdown content. + * + * @return the markdownUri value. + */ + public String markdownUri() { + return this.markdownUri; + } + + /** + * Set the markdownUri property: The uri of markdown content. + * + * @param markdownUri the markdownUri value to set. + * @return the MarkdownPartMetadataSettingsContentSettings object itself. + */ + public MarkdownPartMetadataSettingsContentSettings withMarkdownUri(String markdownUri) { + this.markdownUri = markdownUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Operations.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Operations.java new file mode 100644 index 000000000000..084e218da993 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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.portal.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * The Microsoft Portal operations API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations. + */ + PagedIterable list(); + + /** + * The Microsoft Portal operations API. + * + * @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 results of the request to list operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/PatchableDashboard.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/PatchableDashboard.java new file mode 100644 index 000000000000..0153c811c662 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/PatchableDashboard.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The shared dashboard resource definition. */ +@JsonFlatten +@Fluent +public class PatchableDashboard { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchableDashboard.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The dashboard lenses. + */ + @JsonProperty(value = "properties.lenses") + private List lenses; + + /* + * The dashboard metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PatchableDashboard object itself. + */ + public PatchableDashboard withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the lenses property: The dashboard lenses. + * + * @return the lenses value. + */ + public List lenses() { + return this.lenses; + } + + /** + * Set the lenses property: The dashboard lenses. + * + * @param lenses the lenses value to set. + * @return the PatchableDashboard object itself. + */ + public PatchableDashboard withLenses(List lenses) { + this.lenses = lenses; + return this; + } + + /** + * Get the metadata property: The dashboard metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The dashboard metadata. + * + * @param metadata the metadata value to set. + * @return the PatchableDashboard object itself. + */ + public PatchableDashboard withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lenses() != null) { + lenses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperation.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperation.java new file mode 100644 index 000000000000..b23139cfb074 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperation.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.portal.models; + +import com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; + +/** An immutable client-side representation of ResourceProviderOperation. */ +public interface ResourceProviderOperation { + /** + * Gets the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + String isDataAction(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner object. + * + * @return the inner object. + */ + ResourceProviderOperationInner innerModel(); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationDisplay.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationDisplay.java new file mode 100644 index 000000000000..d14f22a6d3dd --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationDisplay.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.portal.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; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Resource provider: Microsoft Custom Providers. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of this operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider: Microsoft Custom Providers. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider: Microsoft Custom Providers. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of this operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of this operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationList.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationList.java new file mode 100644 index 000000000000..248cdfdc183c --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationList.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.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationList.class); + + /* + * List of operations supported by this resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by this resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by this resource provider. + * + * @param value the value value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/TenantConfigurations.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/TenantConfigurations.java new file mode 100644 index 000000000000..9c1149eb99ef --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/TenantConfigurations.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.portal.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.portal.fluent.models.ConfigurationInner; + +/** Resource collection API of TenantConfigurations. */ +public interface TenantConfigurations { + /** + * Gets list of the tenant configurations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of the tenant configurations. + */ + PagedIterable list(); + + /** + * Gets list of the tenant configurations. + * + * @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 list of the tenant configurations. + */ + PagedIterable list(Context context); + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the tenant configuration. + */ + Configuration get(ConfigurationName configurationName); + + /** + * Gets the tenant configuration. + * + * @param configurationName The configuration name. Value must be 'default'. + * @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 tenant configuration. + */ + Response getWithResponse(ConfigurationName configurationName, Context context); + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tenant configuration. + */ + Configuration create(ConfigurationName configurationName, ConfigurationInner tenantConfiguration); + + /** + * Create the tenant configuration. If configuration already exists - update it. User has to be a Tenant Admin for + * this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param tenantConfiguration Tenant configuration. + * @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 tenant configuration. + */ + Response createWithResponse( + ConfigurationName configurationName, ConfigurationInner tenantConfiguration, Context context); + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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(ConfigurationName configurationName); + + /** + * Delete the tenant configuration. User has to be a Tenant Admin for this operation. + * + * @param configurationName The configuration name. Value must be 'default'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(ConfigurationName configurationName, Context context); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Violation.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Violation.java new file mode 100644 index 000000000000..6d6b2900b302 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Violation.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.portal.models; + +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; + +/** An immutable client-side representation of Violation. */ +public interface Violation { + /** + * Gets the id property: Id of the item that violates tenant configuration. + * + * @return the id value. + */ + String id(); + + /** + * Gets the userId property: Id of the user who owns violated item. + * + * @return the userId value. + */ + String userId(); + + /** + * Gets the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the inner com.azure.resourcemanager.portal.fluent.models.ViolationInner object. + * + * @return the inner object. + */ + ViolationInner innerModel(); +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ViolationsList.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ViolationsList.java new file mode 100644 index 000000000000..6574216aa50e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ViolationsList.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.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of list of items that violate tenant's configuration. */ +@Fluent +public final class ViolationsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ViolationsList.class); + + /* + * The array of violations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The array of violations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of violations. + * + * @param value the value value to set. + * @return the ViolationsList object itself. + */ + public ViolationsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ViolationsList object itself. + */ + public ViolationsList 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/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/package-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/package-info.java new file mode 100644 index 000000000000..e5d317c11d46 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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 Portal. Allows creation and deletion of Azure Shared Dashboards. */ +package com.azure.resourcemanager.portal.models; diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/package-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/package-info.java new file mode 100644 index 000000000000..0bec8332a287 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/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 Portal. Allows creation and deletion of Azure Shared Dashboards. */ +package com.azure.resourcemanager.portal; diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/module-info.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/module-info.java new file mode 100644 index 000000000000..5661f1b993e6 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/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.portal { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.portal; + exports com.azure.resourcemanager.portal.fluent; + exports com.azure.resourcemanager.portal.fluent.models; + exports com.azure.resourcemanager.portal.models; + + opens com.azure.resourcemanager.portal.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.portal.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/portal/ci.yml b/sdk/portal/ci.yml new file mode 100644 index 000000000000..ce086aff5a43 --- /dev/null +++ b/sdk/portal/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/portal/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/portal/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: portal + Artifacts: + - name: azure-resourcemanager-portal + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerportal diff --git a/sdk/portal/pom.xml b/sdk/portal/pom.xml new file mode 100644 index 000000000000..c6e5dace86b8 --- /dev/null +++ b/sdk/portal/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-portal-service + pom + 1.0.0 + + azure-resourcemanager-portal + +