From a184c299873d6cfc349860fc88e2eac82bdacc57 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 6 Mar 2023 16:05:06 +0000 Subject: [PATCH] CodeGen from PR 2740 in test-repo-billy/azure-rest-api-specs Merge 8a4cf883847789c1252123639b217b25131caf45 into 66e7f9b04a2325fe00afd04d8abdab6ed78b7c4a --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-riskiq/CHANGELOG.md | 5 + .../azure-resourcemanager-riskiq/README.md | 105 ++ .../azure-resourcemanager-riskiq/SAMPLE.md | 272 +++ .../azure-resourcemanager-riskiq/pom.xml | 61 + .../resourcemanager/riskiq/RiskiqManager.java | 314 ++++ .../riskiq/fluent/LabelsClient.java | 238 +++ .../riskiq/fluent/MicrosoftEasm.java | 67 + .../riskiq/fluent/OperationsClient.java | 38 + .../riskiq/fluent/WorkspacesClient.java | 233 +++ .../fluent/models/LabelResourceInner.java | 115 ++ .../models/LabelResourceProperties.java | 78 + .../riskiq/fluent/models/OperationInner.java | 127 ++ .../fluent/models/ResourceBaseProperties.java | 40 + .../fluent/models/WorkspaceResourceInner.java | 84 + .../riskiq/fluent/models/package-info.java | 6 + .../riskiq/fluent/package-info.java | 6 + .../implementation/LabelResourceImpl.java | 57 + .../implementation/LabelsClientImpl.java | 1349 +++++++++++++++ .../riskiq/implementation/LabelsImpl.java | 136 ++ .../implementation/MicrosoftEasmBuilder.java | 144 ++ .../implementation/MicrosoftEasmImpl.java | 318 ++++ .../riskiq/implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 276 ++++ .../riskiq/implementation/OperationsImpl.java | 44 + .../riskiq/implementation/Utils.java | 204 +++ .../implementation/WorkspaceResourceImpl.java | 187 +++ .../implementation/WorkspacesClientImpl.java | 1470 +++++++++++++++++ .../riskiq/implementation/WorkspacesImpl.java | 169 ++ .../riskiq/implementation/package-info.java | 6 + .../riskiq/models/ActionType.java | 44 + .../riskiq/models/LabelPatchResource.java | 40 + .../riskiq/models/LabelResource.java | 67 + .../riskiq/models/LabelResourceList.java | 81 + .../resourcemanager/riskiq/models/Labels.java | 157 ++ .../riskiq/models/Operation.java | 56 + .../riskiq/models/OperationDisplay.java | 91 + .../riskiq/models/OperationListResult.java | 62 + .../riskiq/models/Operations.java | 33 + .../resourcemanager/riskiq/models/Origin.java | 53 + .../riskiq/models/ResourceState.java | 80 + .../riskiq/models/WorkspacePatchResource.java | 69 + .../riskiq/models/WorkspaceResource.java | 214 +++ .../riskiq/models/WorkspaceResourceList.java | 81 + .../riskiq/models/Workspaces.java | 156 ++ .../riskiq/models/package-info.java | 6 + .../resourcemanager/riskiq/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../LabelsCreateAndUpdateSamples.java | 22 + .../riskiq/generated/LabelsDeleteSamples.java | 20 + .../LabelsGetByWorkspaceSamples.java | 23 + .../LabelsListByWorkspaceSamples.java | 20 + .../riskiq/generated/LabelsUpdateSamples.java | 22 + .../generated/OperationsListSamples.java | 20 + .../WorkspacesCreateAndUpdateSamples.java | 25 + .../generated/WorkspacesDeleteSamples.java | 20 + .../WorkspacesGetByResourceGroupSamples.java | 22 + .../WorkspacesListByResourceGroupSamples.java | 20 + .../generated/WorkspacesListSamples.java | 20 + .../generated/WorkspacesUpdateSamples.java | 27 + sdk/riskiq/ci.yml | 47 + sdk/riskiq/pom.xml | 15 + 63 files changed, 7839 insertions(+) create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/CHANGELOG.md create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/README.md create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/SAMPLE.md create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/pom.xml create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/RiskiqManager.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/LabelsClient.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/MicrosoftEasm.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/OperationsClient.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/WorkspacesClient.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceInner.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceProperties.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/OperationInner.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/ResourceBaseProperties.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/WorkspaceResourceInner.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/package-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/package-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelResourceImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsClientImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmBuilder.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsClientImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/Utils.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspaceResourceImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesClientImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesImpl.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/package-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ActionType.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelPatchResource.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResource.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResourceList.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Labels.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operation.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationDisplay.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationListResult.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operations.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Origin.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ResourceState.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspacePatchResource.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResource.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResourceList.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Workspaces.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/package-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/package-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/module-info.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsCreateAndUpdateSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsDeleteSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsGetByWorkspaceSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsListByWorkspaceSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsUpdateSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/OperationsListSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesCreateAndUpdateSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesDeleteSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesGetByResourceGroupSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListByResourceGroupSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListSamples.java create mode 100644 sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesUpdateSamples.java create mode 100644 sdk/riskiq/ci.yml create mode 100644 sdk/riskiq/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ef7aa7a67b4a..c79b52fb0a4e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -398,6 +398,7 @@ com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-riskiq;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 2c7336bffde9..1f120c7240f5 100644 --- a/pom.xml +++ b/pom.xml @@ -148,6 +148,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/riskiq sdk/schemaregistry sdk/scvmm sdk/search diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/CHANGELOG.md b/sdk/riskiq/azure-resourcemanager-riskiq/CHANGELOG.md new file mode 100644 index 000000000000..cbb8b41ea24b --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-03-06) + +- Azure Resource Manager riskiq client library for Java. This package contains Microsoft Azure SDK for riskiq Management SDK. REST APIs for Easm. Package tag package-preview-2022-04-01. 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/riskiq/azure-resourcemanager-riskiq/README.md b/sdk/riskiq/azure-resourcemanager-riskiq/README.md new file mode 100644 index 000000000000..311a605811b7 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager riskiq client library for Java + +Azure Resource Manager riskiq client library for Java. + +This package contains Microsoft Azure SDK for riskiq Management SDK. REST APIs for Easm. Package tag package-preview-2022-04-01. 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-riskiq;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-riskiq + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +RiskiqManager manager = RiskiqManager + .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/riskiq/azure-resourcemanager-riskiq/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/SAMPLE.md b/sdk/riskiq/azure-resourcemanager-riskiq/SAMPLE.md new file mode 100644 index 000000000000..2723d662f16e --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/SAMPLE.md @@ -0,0 +1,272 @@ +# Code snippets and samples + + +## Labels + +- [CreateAndUpdate](#labels_createandupdate) +- [Delete](#labels_delete) +- [GetByWorkspace](#labels_getbyworkspace) +- [ListByWorkspace](#labels_listbyworkspace) +- [Update](#labels_update) + +## Operations + +- [List](#operations_list) + +## Workspaces + +- [CreateAndUpdate](#workspaces_createandupdate) +- [Delete](#workspaces_delete) +- [GetByResourceGroup](#workspaces_getbyresourcegroup) +- [List](#workspaces_list) +- [ListByResourceGroup](#workspaces_listbyresourcegroup) +- [Update](#workspaces_update) +### Labels_CreateAndUpdate + +```java +/** Samples for Labels CreateAndUpdate. */ +public final class LabelsCreateAndUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_CreateAndUpdate.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .createAndUpdate("dummyrg", "ThisisaWorkspace", "ThisisaLabel", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Labels_Delete + +```java +/** Samples for Labels Delete. */ +public final class LabelsDeleteSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_Delete.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.labels().delete("dummyrg", "ThisisaWorkspace", "ThisisaLabel", com.azure.core.util.Context.NONE); + } +} +``` + +### Labels_GetByWorkspace + +```java +/** Samples for Labels GetByWorkspace. */ +public final class LabelsGetByWorkspaceSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_GetByWorkspace.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .getByWorkspaceWithResponse( + "dummyrg", "ThisisaWorkspace", "ThisisaLabel", com.azure.core.util.Context.NONE); + } +} +``` + +### Labels_ListByWorkspace + +```java +/** Samples for Labels ListByWorkspace. */ +public final class LabelsListByWorkspaceSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_ListByWorkspace.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.labels().listByWorkspace("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Labels_Update + +```java +/** Samples for Labels Update. */ +public final class LabelsUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_Update.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .updateWithResponse("dummyrg", "ThisisaWorkspace", "ThisisaLabel", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations. + * + * @param manager Entry point to RiskiqManager. + */ + public static void operations(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_CreateAndUpdate + +```java +/** Samples for Workspaces CreateAndUpdate. */ +public final class WorkspacesCreateAndUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_CreateAndUpdate.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .workspaces() + .define("ThisisaWorkspace") + .withRegion("West US") + .withExistingResourceGroup("dummyrg") + .create(); + } +} +``` + +### Workspaces_Delete + +```java +/** Samples for Workspaces Delete. */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Delete.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().delete("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_GetByResourceGroup + +```java +/** Samples for Workspaces GetByResourceGroup. */ +public final class WorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Get.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .workspaces() + .getByResourceGroupWithResponse("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_List + +```java +/** Samples for Workspaces List. */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_ListBySubscription.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_ListByResourceGroup + +```java +/** Samples for Workspaces ListByResourceGroup. */ +public final class WorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_ListByResourceGroup.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_Update + +```java +import com.azure.resourcemanager.riskiq.models.WorkspaceResource; + +/** Samples for Workspaces Update. */ +public final class WorkspacesUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Update.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + WorkspaceResource resource = + manager + .workspaces() + .getByResourceGroupWithResponse("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/pom.xml b/sdk/riskiq/azure-resourcemanager-riskiq/pom.xml new file mode 100644 index 000000000000..7609165f810a --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-riskiq + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for riskiq Management + This package contains Microsoft Azure SDK for riskiq Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for Easm. Package tag package-preview-2022-04-01. + 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 + 0 + 0 + + + + com.azure + azure-core + 1.37.0 + + + com.azure + azure-core-management + 1.10.2 + + + diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/RiskiqManager.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/RiskiqManager.java new file mode 100644 index 000000000000..ca61eb3cb602 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/RiskiqManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq; + +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.AddHeadersFromContextPolicy; +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.RetryOptions; +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.riskiq.fluent.MicrosoftEasm; +import com.azure.resourcemanager.riskiq.implementation.LabelsImpl; +import com.azure.resourcemanager.riskiq.implementation.MicrosoftEasmBuilder; +import com.azure.resourcemanager.riskiq.implementation.OperationsImpl; +import com.azure.resourcemanager.riskiq.implementation.WorkspacesImpl; +import com.azure.resourcemanager.riskiq.models.Labels; +import com.azure.resourcemanager.riskiq.models.Operations; +import com.azure.resourcemanager.riskiq.models.Workspaces; +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 RiskiqManager. REST APIs for Easm. */ +public final class RiskiqManager { + private Workspaces workspaces; + + private Labels labels; + + private Operations operations; + + private final MicrosoftEasm clientObject; + + private RiskiqManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftEasmBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of riskiq service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the riskiq service API instance. + */ + public static RiskiqManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of riskiq service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the riskiq service API instance. + */ + public static RiskiqManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new RiskiqManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create RiskiqManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new RiskiqManager.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 RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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 riskiq service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the riskiq service API instance. + */ + public RiskiqManager 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.riskiq") + .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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + 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 RiskiqManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Workspaces. It manages WorkspaceResource. + * + * @return Resource collection API of Workspaces. + */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** + * Gets the resource collection API of Labels. + * + * @return Resource collection API of Labels. + */ + public Labels labels() { + if (this.labels == null) { + this.labels = new LabelsImpl(clientObject.getLabels(), this); + } + return labels; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client MicrosoftEasm providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MicrosoftEasm serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/LabelsClient.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/LabelsClient.java new file mode 100644 index 000000000000..c9b5fa2548b4 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/LabelsClient.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; +import com.azure.resourcemanager.riskiq.models.LabelPatchResource; + +/** An instance of this class provides access to all the operations defined in LabelsClient. */ +public interface LabelsClient { + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @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 list of labels as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @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 label details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, String labelName, Context context); + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabelResourceInner getByWorkspace(String resourceGroupName, String workspaceName, String labelName); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LabelResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName, String labelName); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @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 SyncPoller} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LabelResourceInner> beginCreateAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabelResourceInner createAndUpdate(String resourceGroupName, String workspaceName, String labelName); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @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 label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabelResourceInner createAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context); + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelPatchResource Label patch details. + * @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 label details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String workspaceName, + String labelName, + LabelPatchResource labelPatchResource, + Context context); + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabelResourceInner update(String resourceGroupName, String workspaceName, String labelName); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, String labelName); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, String labelName, Context context); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName, String labelName); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String labelName, Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/MicrosoftEasm.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/MicrosoftEasm.java new file mode 100644 index 000000000000..822048ac5fb0 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/MicrosoftEasm.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftEasm class. */ +public interface MicrosoftEasm { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); + + /** + * Gets the LabelsClient object to access its operations. + * + * @return the LabelsClient object. + */ + LabelsClient getLabels(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/OperationsClient.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/OperationsClient.java new file mode 100644 index 000000000000..7bef90c5d625 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/OperationsClient.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.riskiq.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.riskiq.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Returns list of operations. + * + * @throws com.azure.core.management.exception.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 list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns list of operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/WorkspacesClient.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/WorkspacesClient.java new file mode 100644 index 000000000000..b7e55bdc4fb5 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/WorkspacesClient.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import com.azure.resourcemanager.riskiq.models.WorkspacePatchResource; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public interface WorkspacesClient { + /** + * Returns a list of workspaces under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns a list of workspaces under the given 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 the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @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 workspace details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceResourceInner getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName); + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @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 SyncPoller} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context); + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceResourceInner createAndUpdate(String resourceGroupName, String workspaceName); + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @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 workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceResourceInner createAndUpdate( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspacePatchResource Workspace patch details. + * @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 workspace details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String workspaceName, WorkspacePatchResource workspacePatchResource, Context context); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceResourceInner update(String resourceGroupName, String workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, Context context); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceInner.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceInner.java new file mode 100644 index 000000000000..8e611f282961 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceInner.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.riskiq.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.riskiq.models.ResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Label details. */ +@Fluent +public class LabelResourceInner extends ProxyResource { + /* + * Label properties + */ + @JsonProperty(value = "properties") + private LabelResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of LabelResourceInner class. */ + public LabelResourceInner() { + } + + /** + * Get the innerProperties property: Label properties. + * + * @return the innerProperties value. + */ + private LabelResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the displayName property: Label display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Label display name. + * + * @param displayName the displayName value to set. + * @return the LabelResourceInner object itself. + */ + public LabelResourceInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new LabelResourceProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the color property: Label color. + * + * @return the color value. + */ + public String color() { + return this.innerProperties() == null ? null : this.innerProperties().color(); + } + + /** + * Set the color property: Label color. + * + * @param color the color value to set. + * @return the LabelResourceInner object itself. + */ + public LabelResourceInner withColor(String color) { + if (this.innerProperties() == null) { + this.innerProperties = new LabelResourceProperties(); + } + this.innerProperties().withColor(color); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceProperties.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceProperties.java new file mode 100644 index 000000000000..3c0738cbba48 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/LabelResourceProperties.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.riskiq.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Label properties. */ +@Fluent +public final class LabelResourceProperties extends ResourceBaseProperties { + /* + * Label display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Label color. + */ + @JsonProperty(value = "color") + private String color; + + /** Creates an instance of LabelResourceProperties class. */ + public LabelResourceProperties() { + } + + /** + * Get the displayName property: Label display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Label display name. + * + * @param displayName the displayName value to set. + * @return the LabelResourceProperties object itself. + */ + public LabelResourceProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the color property: Label color. + * + * @return the color value. + */ + public String color() { + return this.color; + } + + /** + * Set the color property: Label color. + * + * @param color the color value to set. + * @return the LabelResourceProperties object itself. + */ + public LabelResourceProperties withColor(String color) { + this.color = color; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/OperationInner.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/OperationInner.java new file mode 100644 index 000000000000..c9bf9dfc3613 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.riskiq.models.ActionType; +import com.azure.resourcemanager.riskiq.models.OperationDisplay; +import com.azure.resourcemanager.riskiq.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/ResourceBaseProperties.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/ResourceBaseProperties.java new file mode 100644 index 000000000000..72c38ac6c62f --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/ResourceBaseProperties.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.riskiq.models.ResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource base properties. */ +@Immutable +public class ResourceBaseProperties { + /* + * Resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ResourceState provisioningState; + + /** Creates an instance of ResourceBaseProperties class. */ + public ResourceBaseProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/WorkspaceResourceInner.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/WorkspaceResourceInner.java new file mode 100644 index 000000000000..b91b35994203 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/WorkspaceResourceInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.riskiq.models.ResourceState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Workspace details. */ +@Fluent +public final class WorkspaceResourceInner extends Resource { + /* + * Workspace properties. + */ + @JsonProperty(value = "properties") + private ResourceBaseProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of WorkspaceResourceInner class. */ + public WorkspaceResourceInner() { + } + + /** + * Get the innerProperties property: Workspace properties. + * + * @return the innerProperties value. + */ + private ResourceBaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/package-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/models/package-info.java new file mode 100644 index 000000000000..1714e643c08f --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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 MicrosoftEasm. REST APIs for Easm. */ +package com.azure.resourcemanager.riskiq.fluent.models; diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/package-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/fluent/package-info.java new file mode 100644 index 000000000000..f417595d9d94 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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 MicrosoftEasm. REST APIs for Easm. */ +package com.azure.resourcemanager.riskiq.fluent; diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelResourceImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelResourceImpl.java new file mode 100644 index 000000000000..442e8ce7264b --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelResourceImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; +import com.azure.resourcemanager.riskiq.models.LabelResource; +import com.azure.resourcemanager.riskiq.models.ResourceState; + +public final class LabelResourceImpl implements LabelResource { + private LabelResourceInner innerObject; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + LabelResourceImpl(LabelResourceInner innerObject, com.azure.resourcemanager.riskiq.RiskiqManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String color() { + return this.innerModel().color(); + } + + public ResourceState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LabelResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsClientImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsClientImpl.java new file mode 100644 index 000000000000..a644940a40d2 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsClientImpl.java @@ -0,0 +1,1349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.riskiq.fluent.LabelsClient; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; +import com.azure.resourcemanager.riskiq.models.LabelPatchResource; +import com.azure.resourcemanager.riskiq.models.LabelResourceList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LabelsClient. */ +public final class LabelsClientImpl implements LabelsClient { + /** The proxy service used to perform REST calls. */ + private final LabelsService service; + + /** The service client containing this operation class. */ + private final MicrosoftEasmImpl client; + + /** + * Initializes an instance of LabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LabelsClientImpl(MicrosoftEasmImpl client) { + this.service = RestProxy.create(LabelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftEasmLabels to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftEasmLabels") + public interface LabelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}/labels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}/labels/{labelName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByWorkspace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @PathParam("labelName") String labelName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}/labels/{labelName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createAndUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @PathParam("labelName") String labelName, + @BodyParam("application/json") LabelResourceInner labelResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}/labels/{labelName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @PathParam("labelName") String labelName, + @BodyParam("application/json") LabelPatchResource labelPatchResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}/labels/{labelName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @PathParam("labelName") String labelName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + 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())); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync( + String resourceGroupName, String workspaceName, Context context) { + return new PagedFlux<>( + () -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName)); + } + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + return new PagedIterable<>(listByWorkspaceAsync(resourceGroupName, workspaceName, context)); + } + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName, String labelName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByWorkspaceWithResponseAsync( + String resourceGroupName, String workspaceName, String labelName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByWorkspace( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + accept, + context); + } + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByWorkspaceAsync( + String resourceGroupName, String workspaceName, String labelName) { + return getByWorkspaceWithResponseAsync(resourceGroupName, workspaceName, labelName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, String labelName, Context context) { + return getByWorkspaceWithResponseAsync(resourceGroupName, workspaceName, labelName, context).block(); + } + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabelResourceInner getByWorkspace(String resourceGroupName, String workspaceName, String labelName) { + return getByWorkspaceWithResponse(resourceGroupName, workspaceName, labelName, Context.NONE).getValue(); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, String labelName, LabelResourceInner labelResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + if (labelResource != null) { + labelResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createAndUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + labelResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + if (labelResource != null) { + labelResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createAndUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + labelResource, + accept, + context); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LabelResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String workspaceName, String labelName, LabelResourceInner labelResource) { + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, labelName, labelResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LabelResourceInner.class, + LabelResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LabelResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String workspaceName, String labelName) { + final LabelResourceInner labelResource = null; + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, labelName, labelResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LabelResourceInner.class, + LabelResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LabelResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, labelName, labelResource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LabelResourceInner.class, LabelResourceInner.class, context); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LabelResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName, String labelName) { + final LabelResourceInner labelResource = null; + return this + .beginCreateAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource) + .getSyncPoller(); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of label details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LabelResourceInner> beginCreateAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + return this + .beginCreateAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource, context) + .getSyncPoller(); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String workspaceName, String labelName, LabelResourceInner labelResource) { + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String workspaceName, String labelName) { + final LabelResourceInner labelResource = null; + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabelResourceInner createAndUpdate(String resourceGroupName, String workspaceName, String labelName) { + final LabelResourceInner labelResource = null; + return createAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource).block(); + } + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabelResourceInner createAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + return createAndUpdateAsync(resourceGroupName, workspaceName, labelName, labelResource, context).block(); + } + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelPatchResource Label patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, String labelName, LabelPatchResource labelPatchResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + if (labelPatchResource != null) { + labelPatchResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + labelPatchResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelPatchResource Label patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String workspaceName, + String labelName, + LabelPatchResource labelPatchResource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + if (labelPatchResource != null) { + labelPatchResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + labelPatchResource, + accept, + context); + } + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, String labelName) { + final LabelPatchResource labelPatchResource = null; + return updateWithResponseAsync(resourceGroupName, workspaceName, labelName, labelPatchResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelPatchResource Label patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String workspaceName, + String labelName, + LabelPatchResource labelPatchResource, + Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, labelName, labelPatchResource, context) + .block(); + } + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabelResourceInner update(String resourceGroupName, String workspaceName, String labelName) { + final LabelPatchResource labelPatchResource = null; + return updateWithResponse(resourceGroupName, workspaceName, labelName, labelPatchResource, Context.NONE) + .getValue(); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, String labelName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, String labelName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (labelName == null) { + return Mono.error(new IllegalArgumentException("Parameter labelName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + labelName, + accept, + context); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceName, String labelName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName, labelName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceName, String labelName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, workspaceName, labelName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, String labelName) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, labelName).getSyncPoller(); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, String labelName, Context context) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, labelName, context).getSyncPoller(); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspaceName, String labelName) { + return beginDeleteAsync(resourceGroupName, workspaceName, labelName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspaceName, String labelName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, labelName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName, String labelName) { + deleteAsync(resourceGroupName, workspaceName, labelName).block(); + } + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName, String labelName, Context context) { + deleteAsync(resourceGroupName, workspaceName, labelName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 the list of labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(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.listByWorkspaceNext(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 URL to get the next list of items + *

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 the list of labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync( + 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 + .listByWorkspaceNext(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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsImpl.java new file mode 100644 index 000000000000..8931286f380b --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/LabelsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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.riskiq.fluent.LabelsClient; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; +import com.azure.resourcemanager.riskiq.models.LabelPatchResource; +import com.azure.resourcemanager.riskiq.models.LabelResource; +import com.azure.resourcemanager.riskiq.models.Labels; + +public final class LabelsImpl implements Labels { + private static final ClientLogger LOGGER = new ClientLogger(LabelsImpl.class); + + private final LabelsClient innerClient; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + public LabelsImpl(LabelsClient innerClient, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return Utils.mapPage(inner, inner1 -> new LabelResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace( + String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner = + this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return Utils.mapPage(inner, inner1 -> new LabelResourceImpl(inner1, this.manager())); + } + + public Response getByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, String labelName, Context context) { + Response inner = + this.serviceClient().getByWorkspaceWithResponse(resourceGroupName, workspaceName, labelName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LabelResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LabelResource getByWorkspace(String resourceGroupName, String workspaceName, String labelName) { + LabelResourceInner inner = this.serviceClient().getByWorkspace(resourceGroupName, workspaceName, labelName); + if (inner != null) { + return new LabelResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LabelResource createAndUpdate(String resourceGroupName, String workspaceName, String labelName) { + LabelResourceInner inner = this.serviceClient().createAndUpdate(resourceGroupName, workspaceName, labelName); + if (inner != null) { + return new LabelResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public LabelResource createAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context) { + LabelResourceInner inner = + this.serviceClient().createAndUpdate(resourceGroupName, workspaceName, labelName, labelResource, context); + if (inner != null) { + return new LabelResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String workspaceName, + String labelName, + LabelPatchResource labelPatchResource, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, workspaceName, labelName, labelPatchResource, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LabelResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LabelResource update(String resourceGroupName, String workspaceName, String labelName) { + LabelResourceInner inner = this.serviceClient().update(resourceGroupName, workspaceName, labelName); + if (inner != null) { + return new LabelResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String labelName) { + this.serviceClient().delete(resourceGroupName, workspaceName, labelName); + } + + public void delete(String resourceGroupName, String workspaceName, String labelName, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, labelName, context); + } + + private LabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmBuilder.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmBuilder.java new file mode 100644 index 000000000000..1406b4bd3e86 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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.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 MicrosoftEasmImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftEasmImpl.class}) +public final class MicrosoftEasmBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder 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 MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 MicrosoftEasmBuilder. + */ + public MicrosoftEasmBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftEasmImpl with the provided parameters. + * + * @return an instance of MicrosoftEasmImpl. + */ + public MicrosoftEasmImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MicrosoftEasmImpl client = + new MicrosoftEasmImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmImpl.java new file mode 100644 index 000000000000..f8d4ef5fb2f7 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/MicrosoftEasmImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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.CoreUtils; +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.riskiq.fluent.LabelsClient; +import com.azure.resourcemanager.riskiq.fluent.MicrosoftEasm; +import com.azure.resourcemanager.riskiq.fluent.OperationsClient; +import com.azure.resourcemanager.riskiq.fluent.WorkspacesClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MicrosoftEasmImpl type. */ +@ServiceClient(builder = MicrosoftEasmBuilder.class) +public final class MicrosoftEasmImpl implements MicrosoftEasm { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The WorkspacesClient object to access its operations. */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** The LabelsClient object to access its operations. */ + private final LabelsClient labels; + + /** + * Gets the LabelsClient object to access its operations. + * + * @return the LabelsClient object. + */ + public LabelsClient getLabels() { + return this.labels; + } + + /** 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; + } + + /** + * Initializes an instance of MicrosoftEasm client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MicrosoftEasmImpl( + 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 = "2022-04-01-preview"; + this.workspaces = new WorkspacesClientImpl(this); + this.labels = new LabelsClientImpl(this); + this.operations = new OperationsClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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(MicrosoftEasmImpl.class); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationImpl.java new file mode 100644 index 000000000000..038d3fb0b1bd --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationImpl.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.riskiq.implementation; + +import com.azure.resourcemanager.riskiq.fluent.models.OperationInner; +import com.azure.resourcemanager.riskiq.models.ActionType; +import com.azure.resourcemanager.riskiq.models.Operation; +import com.azure.resourcemanager.riskiq.models.OperationDisplay; +import com.azure.resourcemanager.riskiq.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsClientImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..cc00cf11d557 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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.riskiq.fluent.OperationsClient; +import com.azure.resourcemanager.riskiq.fluent.models.OperationInner; +import com.azure.resourcemanager.riskiq.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftEasmImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftEasmImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftEasmOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftEasmOperati") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Easm/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); + } + + /** + * Returns list of operations. + * + * @throws 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 list of REST API operations supported by an Azure Resource Provider 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())); + } + + /** + * Returns list of operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of REST API operations supported by an Azure Resource Provider 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)); + } + + /** + * Returns list of operations. + * + * @throws 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 list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of operations. + * + * @throws 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 list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns list of operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of REST API operations supported by an Azure Resource Provider 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 URL to get the next list of items + *

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 a list of REST API operations supported by an Azure Resource Provider 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 URL to get the next list of items + *

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 a list of REST API operations supported by an Azure Resource Provider 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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6d9d5b768e4d --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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.riskiq.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.riskiq.fluent.OperationsClient; +import com.azure.resourcemanager.riskiq.fluent.models.OperationInner; +import com.azure.resourcemanager.riskiq.models.Operation; +import com.azure.resourcemanager.riskiq.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/Utils.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/Utils.java new file mode 100644 index 000000000000..38aa0cf151e6 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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.riskiq.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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspaceResourceImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspaceResourceImpl.java new file mode 100644 index 000000000000..5c913451e6ae --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspaceResourceImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import com.azure.resourcemanager.riskiq.models.ResourceState; +import com.azure.resourcemanager.riskiq.models.WorkspacePatchResource; +import com.azure.resourcemanager.riskiq.models.WorkspaceResource; +import java.util.Collections; +import java.util.Map; + +public final class WorkspaceResourceImpl + implements WorkspaceResource, WorkspaceResource.Definition, WorkspaceResource.Update { + private WorkspaceResourceInner innerObject; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private WorkspacePatchResource updateWorkspacePatchResource; + + public WorkspaceResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public WorkspaceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createAndUpdate(resourceGroupName, workspaceName, this.innerModel(), Context.NONE); + return this; + } + + public WorkspaceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createAndUpdate(resourceGroupName, workspaceName, this.innerModel(), context); + return this; + } + + WorkspaceResourceImpl(String name, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerObject = new WorkspaceResourceInner(); + this.serviceManager = serviceManager; + this.workspaceName = name; + } + + public WorkspaceResourceImpl update() { + this.updateWorkspacePatchResource = new WorkspacePatchResource(); + return this; + } + + public WorkspaceResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateWorkspacePatchResource, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateWorkspacePatchResource, context) + .getValue(); + return this; + } + + WorkspaceResourceImpl( + WorkspaceResourceInner innerObject, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + } + + public WorkspaceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, context) + .getValue(); + return this; + } + + public WorkspaceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WorkspaceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WorkspaceResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateWorkspacePatchResource.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesClientImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesClientImpl.java new file mode 100644 index 000000000000..ef9a190eb1ac --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesClientImpl.java @@ -0,0 +1,1470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.riskiq.fluent.WorkspacesClient; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import com.azure.resourcemanager.riskiq.models.WorkspacePatchResource; +import com.azure.resourcemanager.riskiq.models.WorkspaceResourceList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public final class WorkspacesClientImpl implements WorkspacesClient { + /** The proxy service used to perform REST calls. */ + private final WorkspacesService service; + + /** The service client containing this operation class. */ + private final MicrosoftEasmImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(MicrosoftEasmImpl client) { + this.service = + RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftEasmWorkspaces to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftEasmWorkspa") + public interface WorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Easm/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createAndUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") WorkspaceResourceInner workspaceResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") WorkspacePatchResource workspacePatchResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Easm/workspaces" + + "/{workspaceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns a list of workspaces under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces 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.getApiVersion(), + this.client.getSubscriptionId(), + 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())); + } + + /** + * Returns a list of workspaces under the given 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 the list of workspaces 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.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of workspaces under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of workspaces under the given 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 the list of workspaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of workspaces under the given subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns a list of workspaces under the given 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 the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces 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)); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + accept, + context); + } + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceResourceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceResource != null) { + workspaceResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createAndUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + workspaceResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspaceResource != null) { + workspaceResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createAndUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + workspaceResource, + accept, + context); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspaceResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource) { + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkspaceResourceInner.class, + WorkspaceResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspaceResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String workspaceName) { + final WorkspaceResourceInner workspaceResource = null; + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkspaceResourceInner.class, + WorkspaceResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspaceResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, workspaceName, workspaceResource, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkspaceResourceInner.class, + WorkspaceResourceInner.class, + context); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName) { + final WorkspaceResourceInner workspaceResource = null; + return this.beginCreateAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource).getSyncPoller(); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of workspace details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceResourceInner> beginCreateAndUpdate( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context) { + return this + .beginCreateAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource, context) + .getSyncPoller(); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource) { + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync(String resourceGroupName, String workspaceName) { + final WorkspaceResourceInner workspaceResource = null; + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context) { + return beginCreateAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceResourceInner createAndUpdate(String resourceGroupName, String workspaceName) { + final WorkspaceResourceInner workspaceResource = null; + return createAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource).block(); + } + + /** + * Create or update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspaceResource Workspace details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceResourceInner createAndUpdate( + String resourceGroupName, String workspaceName, WorkspaceResourceInner workspaceResource, Context context) { + return createAndUpdateAsync(resourceGroupName, workspaceName, workspaceResource, context).block(); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspacePatchResource Workspace patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePatchResource workspacePatchResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspacePatchResource != null) { + workspacePatchResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + workspacePatchResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspacePatchResource Workspace patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String workspaceName, + WorkspacePatchResource workspacePatchResource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspacePatchResource != null) { + workspacePatchResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + workspacePatchResource, + accept, + context); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName) { + final WorkspacePatchResource workspacePatchResource = null; + return updateWithResponseAsync(resourceGroupName, workspaceName, workspacePatchResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param workspacePatchResource Workspace patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String workspaceName, + WorkspacePatchResource workspacePatchResource, + Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, workspacePatchResource, context).block(); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceResourceInner update(String resourceGroupName, String workspaceName) { + final WorkspacePatchResource workspacePatchResource = null; + return updateWithResponse(resourceGroupName, workspaceName, workspacePatchResource, Context.NONE).getValue(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + workspaceName, + accept, + context); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName) { + return this.beginDeleteAsync(resourceGroupName, workspaceName).getSyncPoller(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceName, Context context) { + return this.beginDeleteAsync(resourceGroupName, workspaceName, context).getSyncPoller(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspaceName) { + return beginDeleteAsync(resourceGroupName, workspaceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName) { + deleteAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName, Context context) { + deleteAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 the list of workspaces 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 URL to get the next list of items + *

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 the list of workspaces 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)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 the list of workspaces 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 URL to get the next list of items + *

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 the list of workspaces 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)); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesImpl.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesImpl.java new file mode 100644 index 000000000000..b12042985a0d --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/WorkspacesImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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.riskiq.fluent.WorkspacesClient; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import com.azure.resourcemanager.riskiq.models.WorkspaceResource; +import com.azure.resourcemanager.riskiq.models.Workspaces; + +public final class WorkspacesImpl implements Workspaces { + private static final ClientLogger LOGGER = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final com.azure.resourcemanager.riskiq.RiskiqManager serviceManager; + + public WorkspacesImpl(WorkspacesClient innerClient, com.azure.resourcemanager.riskiq.RiskiqManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new WorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new WorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new WorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new WorkspaceResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceResource getByResourceGroup(String resourceGroupName, String workspaceName) { + WorkspaceResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, workspaceName); + if (inner != null) { + return new WorkspaceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String workspaceName) { + this.serviceClient().delete(resourceGroupName, workspaceName); + } + + public void delete(String resourceGroupName, String workspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, context); + } + + public WorkspaceResource 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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, 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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, 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 workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.delete(resourceGroupName, workspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.delete(resourceGroupName, workspaceName, context); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.riskiq.RiskiqManager manager() { + return this.serviceManager; + } + + public WorkspaceResourceImpl define(String name) { + return new WorkspaceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/package-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/implementation/package-info.java new file mode 100644 index 000000000000..a69475b89b98 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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 MicrosoftEasm. REST APIs for Easm. */ +package com.azure.resourcemanager.riskiq.implementation; diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ActionType.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ActionType.java new file mode 100644 index 000000000000..2b81371d378e --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ActionType.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.riskiq.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelPatchResource.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelPatchResource.java new file mode 100644 index 000000000000..9dd1d337a477 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelPatchResource.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; + +/** Label patch properties. */ +@Fluent +public final class LabelPatchResource extends LabelResourceInner { + /** Creates an instance of LabelPatchResource class. */ + public LabelPatchResource() { + } + + /** {@inheritDoc} */ + @Override + public LabelPatchResource withDisplayName(String displayName) { + super.withDisplayName(displayName); + return this; + } + + /** {@inheritDoc} */ + @Override + public LabelPatchResource withColor(String color) { + super.withColor(color); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResource.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResource.java new file mode 100644 index 000000000000..e4332205b950 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResource.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; + +/** An immutable client-side representation of LabelResource. */ +public interface LabelResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the displayName property: Label display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the color property: Label color. + * + * @return the color value. + */ + String color(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner object. + * + * @return the inner object. + */ + LabelResourceInner innerModel(); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResourceList.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResourceList.java new file mode 100644 index 000000000000..106885bc17a3 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/LabelResourceList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.riskiq.fluent.models.LabelResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of labels. */ +@Fluent +public final class LabelResourceList { + /* + * The list of labels. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of Label list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of LabelResourceList class. */ + public LabelResourceList() { + } + + /** + * Get the value property: The list of labels. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of labels. + * + * @param value the value value to set. + * @return the LabelResourceList object itself. + */ + public LabelResourceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of Label list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of Label list. + * + * @param nextLink the nextLink value to set. + * @return the LabelResourceList object itself. + */ + public LabelResourceList 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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Labels.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Labels.java new file mode 100644 index 000000000000..bc193e8a22e0 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Labels.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.riskiq.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.riskiq.fluent.models.LabelResourceInner; + +/** Resource collection API of Labels. */ +public interface Labels { + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of labels as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Returns a list of labels in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @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 list of labels as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @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 label details along with {@link Response}. + */ + Response getByWorkspaceWithResponse( + String resourceGroupName, String workspaceName, String labelName, Context context); + + /** + * Returns a label in the given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + LabelResource getByWorkspace(String resourceGroupName, String workspaceName, String labelName); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + LabelResource createAndUpdate(String resourceGroupName, String workspaceName, String labelName); + + /** + * Create or update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelResource Label details. + * @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 label details. + */ + LabelResource createAndUpdate( + String resourceGroupName, + String workspaceName, + String labelName, + LabelResourceInner labelResource, + Context context); + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param labelPatchResource Label patch details. + * @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 label details along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String workspaceName, + String labelName, + LabelPatchResource labelPatchResource, + Context context); + + /** + * Update a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return label details. + */ + LabelResource update(String resourceGroupName, String workspaceName, String labelName); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String labelName); + + /** + * Delete a Label. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param labelName The name of the Label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String labelName, Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operation.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operation.java new file mode 100644 index 000000000000..7676a8a8d222 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.resourcemanager.riskiq.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.riskiq.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationDisplay.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationDisplay.java new file mode 100644 index 000000000000..5e4ac444c7c9 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationListResult.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationListResult.java new file mode 100644 index 000000000000..560ea8d0c64b --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.riskiq.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operations.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operations.java new file mode 100644 index 000000000000..fe252165f19d --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Returns list of operations. + * + * @throws com.azure.core.management.exception.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 list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Returns list of operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Origin.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Origin.java new file mode 100644 index 000000000000..29de3d5bc8b6 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ResourceState.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ResourceState.java new file mode 100644 index 000000000000..103d98d25a2c --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/ResourceState.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.riskiq.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Resources provisioning states. */ +public final class ResourceState extends ExpandableStringEnum { + /** Static value NotSpecified for ResourceState. */ + public static final ResourceState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Accepted for ResourceState. */ + public static final ResourceState ACCEPTED = fromString("Accepted"); + + /** Static value Creating for ResourceState. */ + public static final ResourceState CREATING = fromString("Creating"); + + /** Static value Succeeded for ResourceState. */ + public static final ResourceState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ResourceState. */ + public static final ResourceState FAILED = fromString("Failed"); + + /** Static value Canceled for ResourceState. */ + public static final ResourceState CANCELED = fromString("Canceled"); + + /** Static value ProvisioningResources for ResourceState. */ + public static final ResourceState PROVISIONING_RESOURCES = fromString("ProvisioningResources"); + + /** Static value InstallingApplication for ResourceState. */ + public static final ResourceState INSTALLING_APPLICATION = fromString("InstallingApplication"); + + /** Static value ConfiguringApplication for ResourceState. */ + public static final ResourceState CONFIGURING_APPLICATION = fromString("ConfiguringApplication"); + + /** Static value MigratingApplicationData for ResourceState. */ + public static final ResourceState MIGRATING_APPLICATION_DATA = fromString("MigratingApplicationData"); + + /** Static value RunningValidations for ResourceState. */ + public static final ResourceState RUNNING_VALIDATIONS = fromString("RunningValidations"); + + /** Static value CreatingArtifacts for ResourceState. */ + public static final ResourceState CREATING_ARTIFACTS = fromString("CreatingArtifacts"); + + /** Static value DeletingArtifacts for ResourceState. */ + public static final ResourceState DELETING_ARTIFACTS = fromString("DeletingArtifacts"); + + /** + * Creates a new instance of ResourceState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceState() { + } + + /** + * Creates or finds a ResourceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceState. + */ + @JsonCreator + public static ResourceState fromString(String name) { + return fromString(name, ResourceState.class); + } + + /** + * Gets known ResourceState values. + * + * @return known ResourceState values. + */ + public static Collection values() { + return values(ResourceState.class); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspacePatchResource.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspacePatchResource.java new file mode 100644 index 000000000000..948721fdee83 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspacePatchResource.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Workspace patch properties. */ +@Fluent +public final class WorkspacePatchResource { + /* + * resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of WorkspacePatchResource class. */ + public WorkspacePatchResource() { + } + + /** + * 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 WorkspacePatchResource object itself. + */ + public WorkspacePatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResource.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResource.java new file mode 100644 index 000000000000..7c8bd3071569 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResource.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import java.util.Map; + +/** An immutable client-side representation of WorkspaceResource. */ +public interface WorkspaceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceState provisioningState(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner object. + * + * @return the inner object. + */ + WorkspaceResourceInner innerModel(); + + /** The entirety of the WorkspaceResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The WorkspaceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkspaceResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the WorkspaceResource 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 WorkspaceResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the WorkspaceResource 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceResource create(Context context); + } + /** The stage of the WorkspaceResource 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); + } + } + /** + * Begins update for the WorkspaceResource resource. + * + * @return the stage of resource update. + */ + WorkspaceResource.Update update(); + + /** The template for WorkspaceResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceResource apply(Context context); + } + /** The WorkspaceResource update stages. */ + interface UpdateStages { + /** The stage of the WorkspaceResource 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); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceResource refresh(Context context); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResourceList.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResourceList.java new file mode 100644 index 000000000000..b64220ce7346 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/WorkspaceResourceList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.riskiq.fluent.models.WorkspaceResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of workspaces. */ +@Fluent +public final class WorkspaceResourceList { + /* + * The link used to get the next page of Workspace list. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * The list of workspaces. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of WorkspaceResourceList class. */ + public WorkspaceResourceList() { + } + + /** + * Get the nextLink property: The link used to get the next page of Workspace list. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of Workspace list. + * + * @param nextLink the nextLink value to set. + * @return the WorkspaceResourceList object itself. + */ + public WorkspaceResourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: The list of workspaces. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of workspaces. + * + * @param value the value value to set. + * @return the WorkspaceResourceList object itself. + */ + public WorkspaceResourceList withValue(List value) { + this.value = value; + 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/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Workspaces.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Workspaces.java new file mode 100644 index 000000000000..880b0a23f8e0 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/Workspaces.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.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 Workspaces. */ +public interface Workspaces { + /** + * Returns a list of workspaces under the given subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Returns a list of workspaces under the given 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 the list of workspaces as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Returns a list of workspaces in the given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workspaces as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @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 workspace details along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Returns a workspace with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace details. + */ + WorkspaceResource getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, Context context); + + /** + * Returns a workspace with the given name. + * + * @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 workspace details along with {@link Response}. + */ + WorkspaceResource getById(String id); + + /** + * Returns a workspace with the given name. + * + * @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 workspace details along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceResource resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceResource definition. + */ + WorkspaceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/package-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/models/package-info.java new file mode 100644 index 000000000000..3bc8feb1c753 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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 MicrosoftEasm. REST APIs for Easm. */ +package com.azure.resourcemanager.riskiq.models; diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/package-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/package-info.java new file mode 100644 index 000000000000..42c31b5df234 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/com/azure/resourcemanager/riskiq/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 MicrosoftEasm. REST APIs for Easm. */ +package com.azure.resourcemanager.riskiq; diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/module-info.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/main/java/module-info.java new file mode 100644 index 000000000000..e32dc6915df5 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/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.riskiq { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.riskiq; + exports com.azure.resourcemanager.riskiq.fluent; + exports com.azure.resourcemanager.riskiq.fluent.models; + exports com.azure.resourcemanager.riskiq.models; + + opens com.azure.resourcemanager.riskiq.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.riskiq.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsCreateAndUpdateSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsCreateAndUpdateSamples.java new file mode 100644 index 000000000000..7dd538bd4dcb --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsCreateAndUpdateSamples.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.riskiq.generated; + +/** Samples for Labels CreateAndUpdate. */ +public final class LabelsCreateAndUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_CreateAndUpdate.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .createAndUpdate("dummyrg", "ThisisaWorkspace", "ThisisaLabel", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsDeleteSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsDeleteSamples.java new file mode 100644 index 000000000000..9863cd75303f --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Labels Delete. */ +public final class LabelsDeleteSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_Delete.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.labels().delete("dummyrg", "ThisisaWorkspace", "ThisisaLabel", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsGetByWorkspaceSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsGetByWorkspaceSamples.java new file mode 100644 index 000000000000..a4aef74a745f --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsGetByWorkspaceSamples.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.riskiq.generated; + +/** Samples for Labels GetByWorkspace. */ +public final class LabelsGetByWorkspaceSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_GetByWorkspace.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .getByWorkspaceWithResponse( + "dummyrg", "ThisisaWorkspace", "ThisisaLabel", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsListByWorkspaceSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsListByWorkspaceSamples.java new file mode 100644 index 000000000000..d575c5de79e2 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsListByWorkspaceSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Labels ListByWorkspace. */ +public final class LabelsListByWorkspaceSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_ListByWorkspace.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.labels().listByWorkspace("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsUpdateSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsUpdateSamples.java new file mode 100644 index 000000000000..17000fb803d2 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/LabelsUpdateSamples.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.riskiq.generated; + +/** Samples for Labels Update. */ +public final class LabelsUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Labels_Update.json + */ + /** + * Sample code: Labels. + * + * @param manager Entry point to RiskiqManager. + */ + public static void labels(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .labels() + .updateWithResponse("dummyrg", "ThisisaWorkspace", "ThisisaLabel", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/OperationsListSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/OperationsListSamples.java new file mode 100644 index 000000000000..82d0f41f8844 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations. + * + * @param manager Entry point to RiskiqManager. + */ + public static void operations(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesCreateAndUpdateSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesCreateAndUpdateSamples.java new file mode 100644 index 000000000000..cb3080d5d90b --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesCreateAndUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Workspaces CreateAndUpdate. */ +public final class WorkspacesCreateAndUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_CreateAndUpdate.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .workspaces() + .define("ThisisaWorkspace") + .withRegion("West US") + .withExistingResourceGroup("dummyrg") + .create(); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesDeleteSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesDeleteSamples.java new file mode 100644 index 000000000000..876e41f1c4e6 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Workspaces Delete. */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Delete.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().delete("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesGetByResourceGroupSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..22b5f46aa04d --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesGetByResourceGroupSamples.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.riskiq.generated; + +/** Samples for Workspaces GetByResourceGroup. */ +public final class WorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Get.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager + .workspaces() + .getByResourceGroupWithResponse("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListByResourceGroupSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListByResourceGroupSamples.java new file mode 100644 index 000000000000..797cbbfd6f09 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Workspaces ListByResourceGroup. */ +public final class WorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_ListByResourceGroup.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListSamples.java new file mode 100644 index 000000000000..884fcbc48331 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +/** Samples for Workspaces List. */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_ListBySubscription.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + manager.workspaces().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesUpdateSamples.java b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesUpdateSamples.java new file mode 100644 index 000000000000..fcd21faff138 --- /dev/null +++ b/sdk/riskiq/azure-resourcemanager-riskiq/src/samples/java/com/azure/resourcemanager/riskiq/generated/WorkspacesUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.riskiq.generated; + +import com.azure.resourcemanager.riskiq.models.WorkspaceResource; + +/** Samples for Workspaces Update. */ +public final class WorkspacesUpdateSamples { + /* + * x-ms-original-file: specification/riskiq/resource-manager/Microsoft.Easm/preview/2022-04-01-preview/examples/Workspaces_Update.json + */ + /** + * Sample code: Workspaces. + * + * @param manager Entry point to RiskiqManager. + */ + public static void workspaces(com.azure.resourcemanager.riskiq.RiskiqManager manager) { + WorkspaceResource resource = + manager + .workspaces() + .getByResourceGroupWithResponse("dummyrg", "ThisisaWorkspace", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/riskiq/ci.yml b/sdk/riskiq/ci.yml new file mode 100644 index 000000000000..6cf1ddf2e83a --- /dev/null +++ b/sdk/riskiq/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/riskiq/ci.yml + - sdk/riskiq/azure-resourcemanager-riskiq/ + exclude: + - sdk/riskiq/pom.xml + - sdk/riskiq/azure-resourcemanager-riskiq/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/riskiq/ci.yml + - sdk/riskiq/azure-resourcemanager-riskiq/ + exclude: + - sdk/riskiq/pom.xml + - sdk/riskiq/azure-resourcemanager-riskiq/pom.xml + +parameters: + - name: release_azureresourcemanagerriskiq + displayName: azure-resourcemanager-riskiq + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: riskiq + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-riskiq + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerriskiq + releaseInBatch: ${{ parameters.release_azureresourcemanagerriskiq }} diff --git a/sdk/riskiq/pom.xml b/sdk/riskiq/pom.xml new file mode 100644 index 000000000000..d9edb4ad3f39 --- /dev/null +++ b/sdk/riskiq/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-riskiq-service + pom + 1.0.0 + + + azure-resourcemanager-riskiq + +