From e8550a79681c2a16ca177a4d8372a95b742ea0e2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 15 Mar 2022 11:03:52 +0000 Subject: [PATCH] CodeGen from PR 18255 in Azure/azure-rest-api-specs Merge 947333e51a47a11269064ddd0cb1eafa057a621f into 6354ca8bf06ea064f4f0fef331a10c1baf62ac35 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-portal/CHANGELOG.md | 5 + .../azure-resourcemanager-portal/README.md | 102 ++ .../azure-resourcemanager-portal/SAMPLE.md | 362 +++++ .../azure-resourcemanager-portal/pom.xml | 55 + .../resourcemanager/portal/PortalManager.java | 281 ++++ .../portal/fluent/DashboardsClient.java | 177 +++ ...stTenantConfigurationViolationsClient.java | 38 + .../portal/fluent/OperationsClient.java | 36 + .../resourcemanager/portal/fluent/Portal.java | 74 + .../fluent/TenantConfigurationsClient.java | 117 ++ .../fluent/models/ConfigurationInner.java | 64 + .../models/ConfigurationProperties.java | 50 + .../portal/fluent/models/DashboardInner.java | 102 ++ .../fluent/models/DashboardProperties.java | 80 ++ .../ResourceProviderOperationInner.java | 102 ++ .../portal/fluent/models/ViolationInner.java | 65 + .../portal/fluent/models/package-info.java | 6 + .../portal/fluent/package-info.java | 6 + .../implementation/ConfigurationImpl.java | 43 + .../portal/implementation/DashboardImpl.java | 213 +++ .../implementation/DashboardsClientImpl.java | 1248 +++++++++++++++++ .../portal/implementation/DashboardsImpl.java | 168 +++ ...nantConfigurationViolationsClientImpl.java | 277 ++++ ...ListTenantConfigurationViolationsImpl.java | 46 + .../implementation/OperationsClientImpl.java | 271 ++++ .../portal/implementation/OperationsImpl.java | 44 + .../portal/implementation/PortalBuilder.java | 146 ++ .../portal/implementation/PortalImpl.java | 336 +++++ .../ResourceProviderOperationImpl.java | 41 + .../TenantConfigurationsClientImpl.java | 665 +++++++++ .../TenantConfigurationsImpl.java | 102 ++ .../portal/implementation/Utils.java | 204 +++ .../portal/implementation/ViolationImpl.java | 39 + .../portal/implementation/package-info.java | 6 + .../portal/models/Configuration.java | 46 + .../portal/models/ConfigurationList.java | 77 + .../portal/models/ConfigurationName.java | 31 + .../portal/models/Dashboard.java | 248 ++++ .../portal/models/DashboardLens.java | 112 ++ .../portal/models/DashboardListResult.java | 77 + .../portal/models/DashboardPartMetadata.java | 70 + .../portal/models/DashboardParts.java | 85 ++ .../portal/models/DashboardPartsPosition.java | 153 ++ .../portal/models/Dashboards.java | 157 +++ .../ListTenantConfigurationViolations.java | 31 + .../portal/models/MarkdownPartMetadata.java | 82 ++ .../models/MarkdownPartMetadataSettings.java | 49 + .../MarkdownPartMetadataSettingsContent.java | 49 + ...wnPartMetadataSettingsContentSettings.java | 150 ++ .../portal/models/Operations.java | 31 + .../portal/models/PatchableDashboard.java | 115 ++ .../models/ResourceProviderOperation.java | 38 + .../ResourceProviderOperationDisplay.java | 124 ++ .../models/ResourceProviderOperationList.java | 77 + .../portal/models/TenantConfigurations.java | 106 ++ .../portal/models/Violation.java | 38 + .../portal/models/ViolationsList.java | 77 + .../portal/models/package-info.java | 6 + .../resourcemanager/portal/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../DashboardsCreateOrUpdateSamples.java | 78 ++ .../generated/DashboardsDeleteSamples.java | 22 + .../DashboardsGetByResourceGroupSamples.java | 22 + .../DashboardsListByResourceGroupSamples.java | 23 + .../generated/DashboardsListSamples.java | 23 + .../generated/DashboardsUpdateSamples.java | 38 + ...antConfigurationViolationsListSamples.java | 23 + .../generated/OperationsListSamples.java | 22 + .../TenantConfigurationsCreateSamples.java | 29 + .../TenantConfigurationsDeleteSamples.java | 23 + .../TenantConfigurationsGetSamples.java | 23 + .../TenantConfigurationsListSamples.java | 22 + sdk/portal/ci.yml | 39 + sdk/portal/pom.xml | 53 + 76 files changed, 8067 insertions(+) create mode 100644 sdk/portal/azure-resourcemanager-portal/CHANGELOG.md create mode 100644 sdk/portal/azure-resourcemanager-portal/README.md create mode 100644 sdk/portal/azure-resourcemanager-portal/SAMPLE.md create mode 100644 sdk/portal/azure-resourcemanager-portal/pom.xml create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/PortalManager.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/DashboardsClient.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/ListTenantConfigurationViolationsClient.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/OperationsClient.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/Portal.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/TenantConfigurationsClient.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationInner.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationProperties.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardInner.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardProperties.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ResourceProviderOperationInner.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ViolationInner.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/package-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/package-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ConfigurationImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsClientImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsClientImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsClientImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalBuilder.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/PortalImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ResourceProviderOperationImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsClientImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/Utils.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ViolationImpl.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/package-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Configuration.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationList.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationName.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboard.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardLens.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardListResult.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartMetadata.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardParts.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartsPosition.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Dashboards.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ListTenantConfigurationViolations.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadata.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettings.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContent.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContentSettings.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Operations.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/PatchableDashboard.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperation.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationDisplay.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationList.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/TenantConfigurations.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/Violation.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ViolationsList.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/package-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/package-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/main/java/module-info.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsCreateOrUpdateSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsDeleteSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsGetByResourceGroupSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListByResourceGroupSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsUpdateSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/ListTenantConfigurationViolationsListSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/OperationsListSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsCreateSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsDeleteSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsGetSamples.java create mode 100644 sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsListSamples.java create mode 100644 sdk/portal/ci.yml create mode 100644 sdk/portal/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ad9720e1fac93..ee5687ec246cd 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-portal;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 0ce586ceb6e74..68c0de9a397e7 100644 --- a/pom.xml +++ b/pom.xml @@ -936,6 +936,7 @@ sdk/parents sdk/peering sdk/policyinsights + sdk/portal sdk/postgresql sdk/postgresqlflexibleserver sdk/powerbidedicated diff --git a/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md b/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md new file mode 100644 index 0000000000000..8b5caa2c34062 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-15) + +- 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). diff --git a/sdk/portal/azure-resourcemanager-portal/README.md b/sdk/portal/azure-resourcemanager-portal/README.md new file mode 100644 index 0000000000000..33b14b0020016 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/README.md @@ -0,0 +1,102 @@ +# 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). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-portal;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-portal + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PortalManager manager = PortalManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/portal/azure-resourcemanager-portal/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/portal/azure-resourcemanager-portal/SAMPLE.md b/sdk/portal/azure-resourcemanager-portal/SAMPLE.md new file mode 100644 index 0000000000000..c7a53911be054 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/SAMPLE.md @@ -0,0 +1,362 @@ +# Code snippets and samples + + +## Dashboards + +- [CreateOrUpdate](#dashboards_createorupdate) +- [Delete](#dashboards_delete) +- [GetByResourceGroup](#dashboards_getbyresourcegroup) +- [List](#dashboards_list) +- [ListByResourceGroup](#dashboards_listbyresourcegroup) +- [Update](#dashboards_update) + +## ListTenantConfigurationViolations + +- [List](#listtenantconfigurationviolations_list) + +## Operations + +- [List](#operations_list) + +## TenantConfigurations + +- [Create](#tenantconfigurations_create) +- [Delete](#tenantconfigurations_delete) +- [Get](#tenantconfigurations_get) +- [List](#tenantconfigurations_list) +### Dashboards_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.azure.resourcemanager.portal.models.DashboardParts; +import com.azure.resourcemanager.portal.models.DashboardPartsPosition; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Dashboards CreateOrUpdate. */ +public final class DashboardsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/createOrUpdateDashboard.json + */ + /** + * Sample code: Create or update a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void createOrUpdateADashboard(com.azure.resourcemanager.portal.PortalManager manager) + throws IOException { + manager + .dashboards() + .define("testDashboard") + .withRegion("eastus") + .withExistingResourceGroup("testRG") + .withTags(mapOf("aKey", "aValue", "anotherKey", "anotherValue")) + .withLenses( + Arrays + .asList( + new DashboardLens() + .withOrder(1) + .withParts( + Arrays + .asList( + new DashboardParts() + .withPosition( + new DashboardPartsPosition() + .withX(1) + .withY(2) + .withRowSpan(4) + .withColSpan(3)), + new DashboardParts() + .withPosition( + new DashboardPartsPosition() + .withX(5) + .withY(5) + .withRowSpan(6) + .withColSpan(6)))), + new DashboardLens().withOrder(2).withParts(Arrays.asList()))) + .withMetadata( + mapOf( + "metadata", + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"ColSpan\":2,\"RowSpan\":1,\"X\":4,\"Y\":3}", Object.class, SerializerEncoding.JSON))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Dashboards_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Dashboards Delete. */ +public final class DashboardsDeleteSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/deleteDashboard.json + */ + /** + * Sample code: Delete a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void deleteADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().deleteWithResponse("testRG", "testDashboard", Context.NONE); + } +} +``` + +### Dashboards_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Dashboards GetByResourceGroup. */ +public final class DashboardsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/getDashboard.json + */ + /** + * Sample code: Get a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void getADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().getByResourceGroupWithResponse("testRG", "testDashboard", Context.NONE); + } +} +``` + +### Dashboards_List + +```java +import com.azure.core.util.Context; + +/** Samples for Dashboards List. */ +public final class DashboardsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsBySubscription.json + */ + /** + * Sample code: List all custom resource providers on the subscription. + * + * @param manager Entry point to PortalManager. + */ + public static void listAllCustomResourceProvidersOnTheSubscription( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().list(Context.NONE); + } +} +``` + +### Dashboards_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Dashboards ListByResourceGroup. */ +public final class DashboardsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsByResourceGroup.json + */ + /** + * Sample code: List all custom resource providers on the resourceGroup. + * + * @param manager Entry point to PortalManager. + */ + public static void listAllCustomResourceProvidersOnTheResourceGroup( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().listByResourceGroup("testRG", Context.NONE); + } +} +``` + +### Dashboards_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.Dashboard; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Dashboards Update. */ +public final class DashboardsUpdateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/updateDashboard.json + */ + /** + * Sample code: Update a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void updateADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + Dashboard resource = + manager.dashboards().getByResourceGroupWithResponse("testRG", "testDashboard", Context.NONE).getValue(); + resource.update().withTags(mapOf("aKey", "bValue", "anotherKey", "anotherValue2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ListTenantConfigurationViolations_List + +```java +import com.azure.core.util.Context; + +/** Samples for ListTenantConfigurationViolations List. */ +public final class ListTenantConfigurationViolationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurationViolations.json + */ + /** + * Sample code: Get list of of items that violate tenant's configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void getListOfOfItemsThatViolateTenantSConfiguration( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.listTenantConfigurationViolations().list(Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/operationsList.json + */ + /** + * Sample code: List the portal operations. + * + * @param manager Entry point to PortalManager. + */ + public static void listThePortalOperations(com.azure.resourcemanager.portal.PortalManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### TenantConfigurations_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Create. */ +public final class TenantConfigurationsCreateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/CreateOrUpdateTenantConfiguration.json + */ + /** + * Sample code: Create or update Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void createOrUpdateTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager + .tenantConfigurations() + .createWithResponse( + ConfigurationName.DEFAULT, + new ConfigurationInner().withEnforcePrivateMarkdownStorage(true), + Context.NONE); + } +} +``` + +### TenantConfigurations_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Delete. */ +public final class TenantConfigurationsDeleteSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/DeleteTenantConfiguration.json + */ + /** + * Sample code: Delete Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void deleteTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().deleteWithResponse(ConfigurationName.DEFAULT, Context.NONE); + } +} +``` + +### TenantConfigurations_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Get. */ +public final class TenantConfigurationsGetSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetTenantConfiguration.json + */ + /** + * Sample code: Get Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void getTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().getWithResponse(ConfigurationName.DEFAULT, Context.NONE); + } +} +``` + +### TenantConfigurations_List + +```java +import com.azure.core.util.Context; + +/** Samples for TenantConfigurations List. */ +public final class TenantConfigurationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurations.json + */ + /** + * Sample code: Get list of Tenant configurations. + * + * @param manager Entry point to PortalManager. + */ + public static void getListOfTenantConfigurations(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().list(Context.NONE); + } +} +``` + diff --git a/sdk/portal/azure-resourcemanager-portal/pom.xml b/sdk/portal/azure-resourcemanager-portal/pom.xml new file mode 100644 index 0000000000000..8b9dc60d8eedf --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/pom.xml @@ -0,0 +1,55 @@ + + 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. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Allows creation and deletion of Azure Shared Dashboards. Package tag package-2020-09-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.26.0 + + + com.azure + azure-core-management + 1.5.3 + + + 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 0000000000000..1df8e796850bd --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/PortalManager.java @@ -0,0 +1,281 @@ +// 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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +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.http.policy.ArmChallengeAuthenticationPolicy; +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; +import java.util.stream.Collectors; + +/** 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 static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = 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; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.portal") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new 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 0000000000000..4018750d713c4 --- /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 parameters required to create or update a 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 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 parameters required to create or update a 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 shared dashboard resource definition along with {@link Response}. + */ + @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 {@link 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 along with {@link Response}. + */ + @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 updatable fields of a 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 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 updatable fields of a 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 shared dashboard resource definition along with {@link Response}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 0000000000000..dd7b331a3e2f7 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 0000000000000..e0834c1d6580e --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 0000000000000..c9721117fc46a --- /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 0000000000000..4ce3835f51185 --- /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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response}. + */ + @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 The parameters required to create or update 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 The parameters required to create or update 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 along with {@link Response}. + */ + @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 {@link 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 0000000000000..25059ed81d9f2 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationInner.java @@ -0,0 +1,64 @@ +// 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.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Tenant configuration. */ +@Fluent +public final class ConfigurationInner extends ProxyResource { + /* + * Tenant configuration properties. + */ + @JsonProperty(value = "properties") + private ConfigurationProperties innerProperties; + + /** + * Get the innerProperties property: Tenant configuration properties. + * + * @return the innerProperties value. + */ + private ConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigurationProperties(); + } + this.innerProperties().withEnforcePrivateMarkdownStorage(enforcePrivateMarkdownStorage); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationProperties.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationProperties.java new file mode 100644 index 0000000000000..9d171e59f1fbe --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ConfigurationProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Tenant configuration properties. */ +@Fluent +public final class ConfigurationProperties { + /* + * When flag is set to true Markdown tile will require external storage + * configuration (URI). The inline content configuration will be + * prohibited. + */ + @JsonProperty(value = "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 ConfigurationProperties object itself. + */ + public ConfigurationProperties 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 0000000000000..fd1121866dafe --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The shared dashboard resource definition. */ +@Fluent +public final class DashboardInner extends Resource { + /* + * The shared dashboard properties. + */ + @JsonProperty(value = "properties") + private DashboardProperties innerProperties; + + /** + * Get the innerProperties property: The shared dashboard properties. + * + * @return the innerProperties value. + */ + private DashboardProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DashboardInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DashboardInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the lenses property: The dashboard lenses. + * + * @return the lenses value. + */ + public List lenses() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DashboardProperties(); + } + this.innerProperties().withLenses(lenses); + return this; + } + + /** + * Get the metadata property: The dashboard metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DashboardProperties(); + } + this.innerProperties().withMetadata(metadata); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardProperties.java b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardProperties.java new file mode 100644 index 0000000000000..bc630760497b2 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/DashboardProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The shared dashboard properties. */ +@Fluent +public final class DashboardProperties { + /* + * The dashboard lenses. + */ + @JsonProperty(value = "lenses") + private List lenses; + + /* + * The dashboard metadata. + */ + @JsonProperty(value = "metadata") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 DashboardProperties object itself. + */ + public DashboardProperties 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 DashboardProperties object itself. + */ + public DashboardProperties 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/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 0000000000000..e2a32f2110b2d --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ResourceProviderOperationInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.portal.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported operations of this resource provider. */ +@Fluent +public final class ResourceProviderOperationInner { + /* + * 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 0000000000000..617c90e7d57e0 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/fluent/models/ViolationInner.java @@ -0,0 +1,65 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Violation information. */ +@Immutable +public final class ViolationInner { + /* + * 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 0000000000000..168e03466d5e6 --- /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 0000000000000..6fe57382cadd5 --- /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 0000000000000..1d6bc125a36e6 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ConfigurationImpl.java @@ -0,0 +1,43 @@ +// 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.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.Configuration; + +public final class ConfigurationImpl implements Configuration { + private ConfigurationInner innerObject; + + private final com.azure.resourcemanager.portal.PortalManager serviceManager; + + ConfigurationImpl(ConfigurationInner innerObject, com.azure.resourcemanager.portal.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 com.azure.resourcemanager.portal.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 0000000000000..843e26447fe21 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardImpl.java @@ -0,0 +1,213 @@ +// 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.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 com.azure.resourcemanager.portal.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 com.azure.resourcemanager.portal.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; + } + + DashboardImpl(String name, com.azure.resourcemanager.portal.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; + } + + DashboardImpl(DashboardInner innerObject, com.azure.resourcemanager.portal.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 0000000000000..05b090f2e738b --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsClientImpl.java @@ -0,0 +1,1248 @@ +// 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.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 { + /** 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 parameters required to create or update a 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 shared dashboard resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The parameters required to create or update a 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 shared dashboard resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 parameters required to create or update a 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 shared dashboard resource definition on successful completion of {@link Mono}. + */ + @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 parameters required to create or update a 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 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 parameters required to create or update a 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 shared dashboard resource definition along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 updatable fields of a 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 shared dashboard resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing Dashboard. + * + * @param resourceGroupName The name of the resource group. + * @param dashboardName The name of the dashboard. + * @param dashboard The updatable fields of a 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 shared dashboard resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @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 updatable fields of a 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 shared dashboard resource definition on successful completion of {@link Mono}. + */ + @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 updatable fields of a 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 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 updatable fields of a 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 shared dashboard resource definition along with {@link Response}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 0000000000000..036fa79657dcb --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/DashboardsImpl.java @@ -0,0 +1,168 @@ +// 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.fluent.DashboardsClient; +import com.azure.resourcemanager.portal.fluent.models.DashboardInner; +import com.azure.resourcemanager.portal.models.Dashboard; +import com.azure.resourcemanager.portal.models.Dashboards; + +public final class DashboardsImpl implements Dashboards { + private static final ClientLogger LOGGER = new ClientLogger(DashboardsImpl.class); + + private final DashboardsClient innerClient; + + private final com.azure.resourcemanager.portal.PortalManager serviceManager; + + public DashboardsImpl(DashboardsClient innerClient, com.azure.resourcemanager.portal.PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(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 Utils.mapPage(inner, inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DashboardImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, 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); + } + + 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 com.azure.resourcemanager.portal.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 0000000000000..606c9658241c7 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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 { + /** 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 0000000000000..1c4af956f2f95 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ListTenantConfigurationViolationsImpl.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.fluent.ListTenantConfigurationViolationsClient; +import com.azure.resourcemanager.portal.fluent.models.ViolationInner; +import com.azure.resourcemanager.portal.models.ListTenantConfigurationViolations; +import com.azure.resourcemanager.portal.models.Violation; + +public final class ListTenantConfigurationViolationsImpl implements ListTenantConfigurationViolations { + private static final ClientLogger LOGGER = new ClientLogger(ListTenantConfigurationViolationsImpl.class); + + private final ListTenantConfigurationViolationsClient innerClient; + + private final com.azure.resourcemanager.portal.PortalManager serviceManager; + + public ListTenantConfigurationViolationsImpl( + ListTenantConfigurationViolationsClient innerClient, + com.azure.resourcemanager.portal.PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ViolationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ViolationImpl(inner1, this.manager())); + } + + private ListTenantConfigurationViolationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.portal.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 0000000000000..c9420f15681c4 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsClientImpl.java @@ -0,0 +1,271 @@ +// 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @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 0000000000000..5c15c93cf6c69 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/OperationsImpl.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.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +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.Operations; +import com.azure.resourcemanager.portal.models.ResourceProviderOperation; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.portal.PortalManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.portal.PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.portal.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 0000000000000..ea019e4598c07 --- /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 0000000000000..60b314d9d8e0d --- /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 { + /** 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 | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PortalImpl.class); +} 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 0000000000000..c0cc06f7d9763 --- /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.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 com.azure.resourcemanager.portal.PortalManager serviceManager; + + ResourceProviderOperationImpl( + ResourceProviderOperationInner innerObject, com.azure.resourcemanager.portal.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 com.azure.resourcemanager.portal.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 0000000000000..893c88f1722fa --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsClientImpl.java @@ -0,0 +1,665 @@ +// 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.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 { + /** 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedFlux}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 as paginated response with {@link PagedIterable}. + */ + @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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 on successful completion of {@link Mono}. + */ + @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 along with {@link Response}. + */ + @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 The parameters required to create or update 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 The parameters required to create or update 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @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 The parameters required to create or update 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 on successful completion of {@link Mono}. + */ + @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 The parameters required to create or update 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 The parameters required to create or update 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 along with {@link Response}. + */ + @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 {@link Response} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 {@link Response} on successful completion of {@link Mono}. + */ + @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 A {@link Mono} that completes when a successful response is received. + */ + @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 {@link 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 0000000000000..18ae623deef93 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/TenantConfigurationsImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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; + +public final class TenantConfigurationsImpl implements TenantConfigurations { + private static final ClientLogger LOGGER = new ClientLogger(TenantConfigurationsImpl.class); + + private final TenantConfigurationsClient innerClient; + + private final com.azure.resourcemanager.portal.PortalManager serviceManager; + + public TenantConfigurationsImpl( + TenantConfigurationsClient innerClient, com.azure.resourcemanager.portal.PortalManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, 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 com.azure.resourcemanager.portal.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 0000000000000..355bf4725450e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/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 0000000000000..53d3860c5bd10 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/implementation/ViolationImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.implementation; + +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 com.azure.resourcemanager.portal.PortalManager serviceManager; + + ViolationImpl(ViolationInner innerObject, com.azure.resourcemanager.portal.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 com.azure.resourcemanager.portal.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 0000000000000..98ac759318adf --- /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 0000000000000..588d85b385ca1 --- /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 0000000000000..7872a75424a65 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ConfigurationList.java @@ -0,0 +1,77 @@ +// 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.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of tenant configurations. */ +@Fluent +public final class ConfigurationList { + /* + * 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 0000000000000..2baf60d89dcab --- /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 0000000000000..a351aa3811f10 --- /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 0000000000000..2ab0fa9abcd8b --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardLens.java @@ -0,0 +1,112 @@ +// 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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A dashboard lens. */ +@Fluent +public final class DashboardLens { + /* + * 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") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DashboardLens.class); +} 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 0000000000000..749e1f2e86d55 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardListResult.java @@ -0,0 +1,77 @@ +// 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.resourcemanager.portal.fluent.models.DashboardInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of dashboards. */ +@Fluent +public final class DashboardListResult { + /* + * 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 0000000000000..ec57a1c32e061 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartMetadata.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.Map; + +/** 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) +}) +@Fluent +public class DashboardPartMetadata { + /* + * A dashboard part metadata. + */ + @JsonIgnore private Map additionalProperties; + + /** + * Get the additionalProperties property: A dashboard part metadata. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: A dashboard part metadata. + * + * @param additionalProperties the additionalProperties value to set. + * @return the DashboardPartMetadata object itself. + */ + public DashboardPartMetadata withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * 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 0000000000000..b85448e1fe245 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardParts.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A dashboard part. */ +@Fluent +public final class DashboardParts { + /* + * 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(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DashboardParts.class); +} 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 0000000000000..1fa7a7390e3f0 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/DashboardPartsPosition.java @@ -0,0 +1,153 @@ +// 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.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The dashboard's part position. */ +@Fluent +public final class DashboardPartsPosition { + /* + * 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") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 0000000000000..22b257d3499cb --- /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 deleteByResourceGroup(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 {@link 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 along with {@link Response}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 along with {@link Response}. + */ + 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 {@link 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 0000000000000..20a063bb48d0d --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 0000000000000..bf32b645dce89 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadata.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.portal.models; + +import com.azure.core.annotation.Fluent; +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 { + /* + * 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 0000000000000..b06e996e52861 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettings.java @@ -0,0 +1,49 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Markdown part settings. */ +@Fluent +public final class MarkdownPartMetadataSettings { + /* + * 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 0000000000000..ce9ce98787500 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContent.java @@ -0,0 +1,49 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The content of markdown part. */ +@Fluent +public final class MarkdownPartMetadataSettingsContent { + /* + * 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 0000000000000..ab82e4c41f092 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/MarkdownPartMetadataSettingsContentSettings.java @@ -0,0 +1,150 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** The setting of the content of markdown part. */ +@Fluent +public final class MarkdownPartMetadataSettingsContentSettings { + /* + * 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 0000000000000..07b350bba94db --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 0000000000000..4d062fee49e49 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/PatchableDashboard.java @@ -0,0 +1,115 @@ +// 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.resourcemanager.portal.fluent.models.DashboardProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The shared dashboard resource definition. */ +@Fluent +public final class PatchableDashboard { + /* + * The shared dashboard properties. + */ + @JsonProperty(value = "properties") + private DashboardProperties innerProperties; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the innerProperties property: The shared dashboard properties. + * + * @return the innerProperties value. + */ + private DashboardProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DashboardProperties(); + } + this.innerProperties().withLenses(lenses); + return this; + } + + /** + * Get the metadata property: The dashboard metadata. + * + * @return the metadata value. + */ + public Map metadata() { + return this.innerProperties() == null ? null : this.innerProperties().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) { + if (this.innerProperties() == null) { + this.innerProperties = new DashboardProperties(); + } + this.innerProperties().withMetadata(metadata); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().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 0000000000000..b23139cfb0746 --- /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 0000000000000..7529b44c282ec --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationDisplay.java @@ -0,0 +1,124 @@ +// 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.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + /* + * 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 0000000000000..39ea7c7ccca36 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ResourceProviderOperationList.java @@ -0,0 +1,77 @@ +// 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.resourcemanager.portal.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationList { + /* + * 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 0000000000000..19eecfbb7dc5d --- /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 as paginated response with {@link PagedIterable}. + */ + 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 as paginated response with {@link PagedIterable}. + */ + 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 along with {@link Response}. + */ + 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 The parameters required to create or update 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 The parameters required to create or update 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 along with {@link Response}. + */ + 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 {@link 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 0000000000000..6d6b2900b3026 --- /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 0000000000000..8a040d04b02c2 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/main/java/com/azure/resourcemanager/portal/models/ViolationsList.java @@ -0,0 +1,77 @@ +// 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.resourcemanager.portal.fluent.models.ViolationInner; +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 { + /* + * 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 0000000000000..e5d317c11d460 --- /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 0000000000000..0bec8332a287a --- /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 0000000000000..5661f1b993e60 --- /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/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsCreateOrUpdateSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ae50616d19262 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsCreateOrUpdateSamples.java @@ -0,0 +1,78 @@ +// 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.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.portal.models.DashboardLens; +import com.azure.resourcemanager.portal.models.DashboardParts; +import com.azure.resourcemanager.portal.models.DashboardPartsPosition; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Dashboards CreateOrUpdate. */ +public final class DashboardsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/createOrUpdateDashboard.json + */ + /** + * Sample code: Create or update a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void createOrUpdateADashboard(com.azure.resourcemanager.portal.PortalManager manager) + throws IOException { + manager + .dashboards() + .define("testDashboard") + .withRegion("eastus") + .withExistingResourceGroup("testRG") + .withTags(mapOf("aKey", "aValue", "anotherKey", "anotherValue")) + .withLenses( + Arrays + .asList( + new DashboardLens() + .withOrder(1) + .withParts( + Arrays + .asList( + new DashboardParts() + .withPosition( + new DashboardPartsPosition() + .withX(1) + .withY(2) + .withRowSpan(4) + .withColSpan(3)), + new DashboardParts() + .withPosition( + new DashboardPartsPosition() + .withX(5) + .withY(5) + .withRowSpan(6) + .withColSpan(6)))), + new DashboardLens().withOrder(2).withParts(Arrays.asList()))) + .withMetadata( + mapOf( + "metadata", + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"ColSpan\":2,\"RowSpan\":1,\"X\":4,\"Y\":3}", Object.class, SerializerEncoding.JSON))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsDeleteSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsDeleteSamples.java new file mode 100644 index 0000000000000..11d7236cb4840 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsDeleteSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Dashboards Delete. */ +public final class DashboardsDeleteSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/deleteDashboard.json + */ + /** + * Sample code: Delete a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void deleteADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().deleteWithResponse("testRG", "testDashboard", Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsGetByResourceGroupSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..98b20f6aafbc2 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Dashboards GetByResourceGroup. */ +public final class DashboardsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/getDashboard.json + */ + /** + * Sample code: Get a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void getADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().getByResourceGroupWithResponse("testRG", "testDashboard", Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListByResourceGroupSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..508364cd5e918 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Dashboards ListByResourceGroup. */ +public final class DashboardsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsByResourceGroup.json + */ + /** + * Sample code: List all custom resource providers on the resourceGroup. + * + * @param manager Entry point to PortalManager. + */ + public static void listAllCustomResourceProvidersOnTheResourceGroup( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().listByResourceGroup("testRG", Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListSamples.java new file mode 100644 index 0000000000000..7fea8f10cb61f --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsListSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Dashboards List. */ +public final class DashboardsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/listDashboardsBySubscription.json + */ + /** + * Sample code: List all custom resource providers on the subscription. + * + * @param manager Entry point to PortalManager. + */ + public static void listAllCustomResourceProvidersOnTheSubscription( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.dashboards().list(Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsUpdateSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsUpdateSamples.java new file mode 100644 index 0000000000000..96b13be65a71e --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/DashboardsUpdateSamples.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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.Dashboard; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Dashboards Update. */ +public final class DashboardsUpdateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/updateDashboard.json + */ + /** + * Sample code: Update a Dashboard. + * + * @param manager Entry point to PortalManager. + */ + public static void updateADashboard(com.azure.resourcemanager.portal.PortalManager manager) { + Dashboard resource = + manager.dashboards().getByResourceGroupWithResponse("testRG", "testDashboard", Context.NONE).getValue(); + resource.update().withTags(mapOf("aKey", "bValue", "anotherKey", "anotherValue2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/ListTenantConfigurationViolationsListSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/ListTenantConfigurationViolationsListSamples.java new file mode 100644 index 0000000000000..97e60a212cd82 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/ListTenantConfigurationViolationsListSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for ListTenantConfigurationViolations List. */ +public final class ListTenantConfigurationViolationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurationViolations.json + */ + /** + * Sample code: Get list of of items that violate tenant's configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void getListOfOfItemsThatViolateTenantSConfiguration( + com.azure.resourcemanager.portal.PortalManager manager) { + manager.listTenantConfigurationViolations().list(Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/OperationsListSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..bdc46a2e955d6 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/operationsList.json + */ + /** + * Sample code: List the portal operations. + * + * @param manager Entry point to PortalManager. + */ + public static void listThePortalOperations(com.azure.resourcemanager.portal.PortalManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsCreateSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsCreateSamples.java new file mode 100644 index 0000000000000..d966c447fef62 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsCreateSamples.java @@ -0,0 +1,29 @@ +// 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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Create. */ +public final class TenantConfigurationsCreateSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/CreateOrUpdateTenantConfiguration.json + */ + /** + * Sample code: Create or update Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void createOrUpdateTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager + .tenantConfigurations() + .createWithResponse( + ConfigurationName.DEFAULT, + new ConfigurationInner().withEnforcePrivateMarkdownStorage(true), + Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsDeleteSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsDeleteSamples.java new file mode 100644 index 0000000000000..3ff7a514a3cfe --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsDeleteSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Delete. */ +public final class TenantConfigurationsDeleteSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/DeleteTenantConfiguration.json + */ + /** + * Sample code: Delete Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void deleteTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().deleteWithResponse(ConfigurationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsGetSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsGetSamples.java new file mode 100644 index 0000000000000..f101fdecb7d15 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsGetSamples.java @@ -0,0 +1,23 @@ +// 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.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.portal.models.ConfigurationName; + +/** Samples for TenantConfigurations Get. */ +public final class TenantConfigurationsGetSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetTenantConfiguration.json + */ + /** + * Sample code: Get Tenant configuration. + * + * @param manager Entry point to PortalManager. + */ + public static void getTenantConfiguration(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().getWithResponse(ConfigurationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsListSamples.java b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsListSamples.java new file mode 100644 index 0000000000000..061dd9c2385b9 --- /dev/null +++ b/sdk/portal/azure-resourcemanager-portal/src/samples/java/com/azure/resourcemanager/portal/generated/TenantConfigurationsListSamples.java @@ -0,0 +1,22 @@ +// 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.generated; + +import com.azure.core.util.Context; + +/** Samples for TenantConfigurations List. */ +public final class TenantConfigurationsListSamples { + /* + * x-ms-original-file: specification/portal/resource-manager/Microsoft.Portal/preview/2020-09-01-preview/examples/TenantConfiguration/GetListOfTenantConfigurations.json + */ + /** + * Sample code: Get list of Tenant configurations. + * + * @param manager Entry point to PortalManager. + */ + public static void getListOfTenantConfigurations(com.azure.resourcemanager.portal.PortalManager manager) { + manager.tenantConfigurations().list(Context.NONE); + } +} diff --git a/sdk/portal/ci.yml b/sdk/portal/ci.yml new file mode 100644 index 0000000000000..04525c2bd8132 --- /dev/null +++ b/sdk/portal/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/portal/ci.yml + - sdk/portal/azure-resourcemanager-portal/ + exclude: + - sdk/portal/pom.xml + - sdk/portal/azure-resourcemanager-portal/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/portal/ci.yml + - sdk/portal/azure-resourcemanager-portal/ + exclude: + - sdk/portal/pom.xml + - sdk/portal/azure-resourcemanager-portal/pom.xml + +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 0000000000000..e7133fea0f4b4 --- /dev/null +++ b/sdk/portal/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-portal-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-portal + + + +