From 04393ec068031554635db24a9b3c5d515eaa118a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 12 May 2023 07:31:41 +0000 Subject: [PATCH 1/2] [Automation] External Change --- eng/mgmt/automation/api-specs.yaml | 2 ++ eng/versioning/version_client.txt | 1 + pom.xml | 1 + sdk/selfhelp/ci.yml | 47 ++++++++++++++++++++++++++++++ sdk/selfhelp/pom.xml | 15 ++++++++++ 5 files changed, 66 insertions(+) create mode 100644 sdk/selfhelp/ci.yml create mode 100644 sdk/selfhelp/pom.xml diff --git a/eng/mgmt/automation/api-specs.yaml b/eng/mgmt/automation/api-specs.yaml index 110c7a36d6f3e..84756912cce55 100644 --- a/eng/mgmt/automation/api-specs.yaml +++ b/eng/mgmt/automation/api-specs.yaml @@ -49,6 +49,8 @@ eventhub: suffix: generated graphservicesprod: service: graphservices +help: + service: selfhelp hybridaks: service: hybridcontainerservice keyvault: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 22b15e60a633e..8d23ad4329578 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -410,6 +410,7 @@ com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-selfhelp;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 f893e1394407d..216e9f2ee0917 100644 --- a/pom.xml +++ b/pom.xml @@ -159,6 +159,7 @@ sdk/security sdk/securitydevops sdk/securityinsights + sdk/selfhelp sdk/servicebus sdk/servicefabric sdk/servicelinker diff --git a/sdk/selfhelp/ci.yml b/sdk/selfhelp/ci.yml new file mode 100644 index 0000000000000..f93bd1842b2b1 --- /dev/null +++ b/sdk/selfhelp/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/selfhelp/ci.yml + - sdk/selfhelp/azure-resourcemanager-selfhelp/ + exclude: + - sdk/selfhelp/pom.xml + - sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/selfhelp/ci.yml + - sdk/selfhelp/azure-resourcemanager-selfhelp/ + exclude: + - sdk/selfhelp/pom.xml + - sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml + +parameters: + - name: release_azureresourcemanagerselfhelp + displayName: azure-resourcemanager-selfhelp + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: selfhelp + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-selfhelp + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerselfhelp + releaseInBatch: ${{ parameters.release_azureresourcemanagerselfhelp }} diff --git a/sdk/selfhelp/pom.xml b/sdk/selfhelp/pom.xml new file mode 100644 index 0000000000000..0b817361339b5 --- /dev/null +++ b/sdk/selfhelp/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-selfhelp-service + pom + 1.0.0 + + + azure-resourcemanager-selfhelp + + From a2295f52a9a7b6575613717dffb5f69c24171415 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 12 May 2023 07:31:46 +0000 Subject: [PATCH 2/2] [Automation] Generate Fluent Lite from help#package-2023-01-01-preview --- .../CHANGELOG.md | 5 + .../azure-resourcemanager-selfhelp/README.md | 105 +++ .../azure-resourcemanager-selfhelp/SAMPLE.md | 155 ++++ .../azure-resourcemanager-selfhelp/pom.xml | 97 +++ .../selfhelp/SelfHelpManager.java | 313 ++++++++ .../selfhelp/fluent/DiagnosticsClient.java | 154 ++++ .../fluent/DiscoverySolutionsClient.java | 57 ++ .../selfhelp/fluent/HelpRP.java | 60 ++ .../selfhelp/fluent/OperationsClient.java | 38 + .../CheckNameAvailabilityResponseInner.java | 105 +++ .../models/DiagnosticResourceInner.java | 137 ++++ .../models/DiagnosticResourceProperties.java | 134 ++++ .../fluent/models/OperationInner.java | 127 +++ .../models/SolutionMetadataProperties.java | 129 ++++ .../models/SolutionMetadataResourceInner.java | 152 ++++ .../selfhelp/fluent/models/package-info.java | 6 + .../selfhelp/fluent/package-info.java | 6 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../DiagnosticResourceImpl.java | 150 ++++ .../implementation/DiagnosticsClientImpl.java | 725 ++++++++++++++++++ .../implementation/DiagnosticsImpl.java | 142 ++++ .../DiscoverySolutionsClientImpl.java | 393 ++++++++++ .../DiscoverySolutionsImpl.java | 47 ++ .../implementation/HelpRPBuilder.java | 123 +++ .../selfhelp/implementation/HelpRPImpl.java | 303 ++++++++ .../implementation/OperationImpl.java | 50 ++ .../implementation/OperationsClientImpl.java | 276 +++++++ .../implementation/OperationsImpl.java | 45 ++ .../SolutionMetadataResourceImpl.java | 68 ++ .../selfhelp/implementation/Utils.java | 204 +++++ .../selfhelp/implementation/package-info.java | 6 + .../selfhelp/models/ActionType.java | 44 ++ .../models/CheckNameAvailabilityRequest.java | 76 ++ .../models/CheckNameAvailabilityResponse.java | 40 + .../selfhelp/models/Diagnostic.java | 135 ++++ .../selfhelp/models/DiagnosticInvocation.java | 79 ++ .../selfhelp/models/DiagnosticResource.java | 159 ++++ .../selfhelp/models/Diagnostics.java | 95 +++ .../selfhelp/models/DiscoveryResponse.java | 81 ++ .../selfhelp/models/DiscoverySolutions.java | 52 ++ .../selfhelp/models/Error.java | 101 +++ .../selfhelp/models/ImportanceLevel.java | 50 ++ .../selfhelp/models/Insight.java | 128 ++++ .../selfhelp/models/Operation.java | 56 ++ .../selfhelp/models/OperationDisplay.java | 91 +++ .../selfhelp/models/OperationListResult.java | 62 ++ .../selfhelp/models/Operations.java | 33 + .../selfhelp/models/Origin.java | 53 ++ .../selfhelp/models/ProvisioningState.java | 53 ++ .../models/SolutionMetadataResource.java | 75 ++ .../selfhelp/models/Status.java | 56 ++ .../selfhelp/models/package-info.java | 6 + .../selfhelp/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...agnosticsCheckNameAvailabilitySamples.java | 46 ++ .../generated/DiagnosticsCreateSamples.java | 26 + .../generated/DiagnosticsGetSamples.java | 25 + .../DiscoverySolutionListSamples.java | 27 + .../generated/OperationsListSamples.java | 20 + .../CheckNameAvailabilityRequestTests.java | 27 + ...eckNameAvailabilityResponseInnerTests.java | 35 + .../generated/DiagnosticInvocationTests.java | 47 ++ .../DiagnosticResourceInnerTests.java | 52 ++ ...NameAvailabilityWithResponseMockTests.java | 75 ++ .../DiagnosticsGetWithResponseMockTests.java | 67 ++ .../generated/DiscoveryResponseTests.java | 61 ++ .../DiscoverySolutionsListMockTests.java | 73 ++ .../selfhelp/generated/InsightTests.java | 40 + .../generated/OperationDisplayTests.java | 25 + .../generated/OperationInnerTests.java | 26 + .../generated/OperationListResultTests.java | 25 + .../generated/OperationsListMockTests.java | 64 ++ .../SolutionMetadataPropertiesTests.java | 40 + .../SolutionMetadataResourceInnerTests.java | 45 ++ .../org.mockito.plugins.MockMaker | 1 + 75 files changed, 6750 insertions(+) create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/CHANGELOG.md create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/README.md create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/SAMPLE.md create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/SelfHelpManager.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiagnosticsClient.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiscoverySolutionsClient.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/HelpRP.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/OperationsClient.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceInner.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceProperties.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/OperationInner.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataProperties.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataResourceInner.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/package-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/package-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticResourceImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsClientImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsClientImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPBuilder.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsClientImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/SolutionMetadataResourceImpl.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/Utils.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/package-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ActionType.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostic.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticInvocation.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticResource.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostics.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoveryResponse.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoverySolutions.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Error.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ImportanceLevel.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Insight.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operation.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationDisplay.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationListResult.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operations.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Origin.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ProvisioningState.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/SolutionMetadataResource.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Status.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/package-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/package-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/module-info.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilitySamples.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCreateSamples.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetSamples.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionListSamples.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/OperationsListSamples.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityRequestTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityResponseInnerTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticInvocationTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticResourceInnerTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilityWithResponseMockTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetWithResponseMockTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoveryResponseTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionsListMockTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/InsightTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationDisplayTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationInnerTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationListResultTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationsListMockTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataPropertiesTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataResourceInnerTests.java create mode 100644 sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/CHANGELOG.md b/sdk/selfhelp/azure-resourcemanager-selfhelp/CHANGELOG.md new file mode 100644 index 0000000000000..d6c11d634e373 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-05-12) + +- Azure Resource Manager Self Help client library for Java. This package contains Microsoft Azure SDK for Self Help Management SDK. Help RP provider. Package tag package-2023-01-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/README.md b/sdk/selfhelp/azure-resourcemanager-selfhelp/README.md new file mode 100644 index 0000000000000..00dd9e9d93b55 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager Self Help client library for Java + +Azure Resource Manager Self Help client library for Java. + +This package contains Microsoft Azure SDK for Self Help Management SDK. Help RP provider. Package tag package-2023-01-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-selfhelp;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-selfhelp + 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(); +SelfHelpManager manager = SelfHelpManager + .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/selfhelp/azure-resourcemanager-selfhelp/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/selfhelp/azure-resourcemanager-selfhelp/SAMPLE.md b/sdk/selfhelp/azure-resourcemanager-selfhelp/SAMPLE.md new file mode 100644 index 0000000000000..7cb1af96579c6 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/SAMPLE.md @@ -0,0 +1,155 @@ +# Code snippets and samples + + +## Diagnostics + +- [CheckNameAvailability](#diagnostics_checknameavailability) +- [Create](#diagnostics_create) +- [Get](#diagnostics_get) + +## DiscoverySolution + +- [List](#discoverysolution_list) + +## Operations + +- [List](#operations_list) +### Diagnostics_CheckNameAvailability + +```java +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; + +/** Samples for Diagnostics CheckNameAvailability. */ +public final class DiagnosticsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsNotAvailable.json + */ + /** + * Sample code: Example when name is not available for a Diagnostic resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void exampleWhenNameIsNotAvailableForADiagnosticResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .checkNameAvailabilityWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", + new CheckNameAvailabilityRequest().withName("sampleName").withType("Microsoft.Help/diagnostics"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsAvailable.json + */ + /** + * Sample code: Example when name is available for a Diagnostic resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void exampleWhenNameIsAvailableForADiagnosticResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .checkNameAvailabilityWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", + new CheckNameAvailabilityRequest().withName("sampleName").withType("Microsoft.Help/diagnostics"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Diagnostics_Create + +```java +/** Samples for Diagnostics Create. */ +public final class DiagnosticsCreateSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CreateDiagnosticForKeyVaultResource.json + */ + /** + * Sample code: Creates a Diagnostic for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void createsADiagnosticForAKeyVaultResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .define("VMNotWorkingInsight") + .withExistingScope( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read") + .create(); + } +} +``` + +### Diagnostics_Get + +```java +/** Samples for Diagnostics Get. */ +public final class DiagnosticsGetSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/GetDiagnosticForKeyVaultResource.json + */ + /** + * Sample code: Gets a Diagnostic for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void getsADiagnosticForAKeyVaultResource(com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .getWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", + "VMNotWorkingInsight", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoverySolution_List + +```java +/** Samples for DiscoverySolution List. */ +public final class DiscoverySolutionListSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/ListDiscoverySolutionsForKeyVaultResource.json + */ + /** + * Sample code: List DiscoverySolutions for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void listDiscoverySolutionsForAKeyVaultResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .discoverySolutions() + .list( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/ListOperations.json + */ + /** + * Sample code: List All Operations. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void listAllOperations(com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml b/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml new file mode 100644 index 0000000000000..476584e9f8a61 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-selfhelp + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Self Help Management + This package contains Microsoft Azure SDK for Self Help Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Help RP provider. Package tag package-2023-01-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.39.0 + + + com.azure + azure-core-management + 1.11.1 + + + com.azure + azure-core-test + 1.17.0 + test + + + com.azure + azure-identity + 1.9.0 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.1 + test + + + org.mockito + mockito-core + 4.11.0 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/SelfHelpManager.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/SelfHelpManager.java new file mode 100644 index 0000000000000..f3f203f57b84b --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/SelfHelpManager.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp; + +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.selfhelp.fluent.HelpRP; +import com.azure.resourcemanager.selfhelp.implementation.DiagnosticsImpl; +import com.azure.resourcemanager.selfhelp.implementation.DiscoverySolutionsImpl; +import com.azure.resourcemanager.selfhelp.implementation.HelpRPBuilder; +import com.azure.resourcemanager.selfhelp.implementation.OperationsImpl; +import com.azure.resourcemanager.selfhelp.models.Diagnostics; +import com.azure.resourcemanager.selfhelp.models.DiscoverySolutions; +import com.azure.resourcemanager.selfhelp.models.Operations; +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 SelfHelpManager. Help RP provider. */ +public final class SelfHelpManager { + private Operations operations; + + private Diagnostics diagnostics; + + private DiscoverySolutions discoverySolutions; + + private final HelpRP clientObject; + + private SelfHelpManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new HelpRPBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Self Help service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Self Help service API instance. + */ + public static SelfHelpManager 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 Self Help service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Self Help service API instance. + */ + public static SelfHelpManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new SelfHelpManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create SelfHelpManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SelfHelpManager.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 Self Help service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Self Help service API instance. + */ + public SelfHelpManager 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.selfhelp") + .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 SelfHelpManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * 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; + } + + /** + * Gets the resource collection API of Diagnostics. It manages DiagnosticResource. + * + * @return Resource collection API of Diagnostics. + */ + public Diagnostics diagnostics() { + if (this.diagnostics == null) { + this.diagnostics = new DiagnosticsImpl(clientObject.getDiagnostics(), this); + } + return diagnostics; + } + + /** + * Gets the resource collection API of DiscoverySolutions. + * + * @return Resource collection API of DiscoverySolutions. + */ + public DiscoverySolutions discoverySolutions() { + if (this.discoverySolutions == null) { + this.discoverySolutions = new DiscoverySolutionsImpl(clientObject.getDiscoverySolutions(), this); + } + return discoverySolutions; + } + + /** + * @return Wrapped service client HelpRP providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public HelpRP serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiagnosticsClient.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiagnosticsClient.java new file mode 100644 index 0000000000000..7eb0312298080 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiagnosticsClient.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in DiagnosticsClient. */ +public interface DiagnosticsClient { + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param checkNameAvailabilityRequest The required parameters for availability check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context); + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(String scope); + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiagnosticResourceInner> beginCreate( + String scope, String diagnosticsResourceName); + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiagnosticResourceInner> beginCreate( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context); + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticResourceInner create(String scope, String diagnosticsResourceName); + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticResourceInner create( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @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 diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String diagnosticsResourceName, Context context); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticResourceInner get(String scope, String diagnosticsResourceName); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiscoverySolutionsClient.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiscoverySolutionsClient.java new file mode 100644 index 0000000000000..e9bdad2222ea3 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/DiscoverySolutionsClient.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.selfhelp.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.selfhelp.fluent.models.SolutionMetadataResourceInner; + +/** An instance of this class provides access to all the operations defined in DiscoverySolutionsClient. */ +public interface DiscoverySolutionsClient { + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 discovery response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String filter, String skiptoken, Context context); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/HelpRP.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/HelpRP.java new file mode 100644 index 0000000000000..1ef5ecec9b037 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/HelpRP.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for HelpRP class. */ +public interface HelpRP { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the DiagnosticsClient object to access its operations. + * + * @return the DiagnosticsClient object. + */ + DiagnosticsClient getDiagnostics(); + + /** + * Gets the DiscoverySolutionsClient object to access its operations. + * + * @return the DiscoverySolutionsClient object. + */ + DiscoverySolutionsClient getDiscoverySolutions(); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/OperationsClient.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/OperationsClient.java new file mode 100644 index 0000000000000..67ec92a136fa6 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..8344cbb345450 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response for whether the requested resource name is available or not. */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + /* + * Returns true or false depending on the availability of the name + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Reason for why value is not available. This field is returned if nameAvailable is false. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * Gets an error message explaining the 'reason' value with more details. This field is returned iif nameAvailable + * is false. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of CheckNameAvailabilityResponseInner class. */ + public CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Returns true or false depending on the availability of the name. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Returns true or false depending on the availability of the name. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Reason for why value is not available. This field is returned if nameAvailable is false. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason for why value is not available. This field is returned if nameAvailable is false. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Gets an error message explaining the 'reason' value with more details. This field is + * returned iif nameAvailable is false. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets an error message explaining the 'reason' value with more details. This field is + * returned iif nameAvailable is false. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceInner.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceInner.java new file mode 100644 index 0000000000000..a27aa33e50a7e --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.selfhelp.models.Diagnostic; +import com.azure.resourcemanager.selfhelp.models.DiagnosticInvocation; +import com.azure.resourcemanager.selfhelp.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Diagnostic resource. */ +@Fluent +public final class DiagnosticResourceInner extends ProxyResource { + /* + * Diagnostic Resource properties. + */ + @JsonProperty(value = "properties") + private DiagnosticResourceProperties 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 DiagnosticResourceInner class. */ + public DiagnosticResourceInner() { + } + + /** + * Get the innerProperties property: Diagnostic Resource properties. + * + * @return the innerProperties value. + */ + private DiagnosticResourceProperties 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 globalParameters property: Global parameters that can be passed to all solutionIds. + * + * @return the globalParameters value. + */ + public Map globalParameters() { + return this.innerProperties() == null ? null : this.innerProperties().globalParameters(); + } + + /** + * Set the globalParameters property: Global parameters that can be passed to all solutionIds. + * + * @param globalParameters the globalParameters value to set. + * @return the DiagnosticResourceInner object itself. + */ + public DiagnosticResourceInner withGlobalParameters(Map globalParameters) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticResourceProperties(); + } + this.innerProperties().withGlobalParameters(globalParameters); + return this; + } + + /** + * Get the insights property: SolutionIds that are needed to be invoked. + * + * @return the insights value. + */ + public List insights() { + return this.innerProperties() == null ? null : this.innerProperties().insights(); + } + + /** + * Set the insights property: SolutionIds that are needed to be invoked. + * + * @param insights the insights value to set. + * @return the DiagnosticResourceInner object itself. + */ + public DiagnosticResourceInner withInsights(List insights) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticResourceProperties(); + } + this.innerProperties().withInsights(insights); + return this; + } + + /** + * Get the acceptedAt property: Diagnostic Request Accepted time. + * + * @return the acceptedAt value. + */ + public String acceptedAt() { + return this.innerProperties() == null ? null : this.innerProperties().acceptedAt(); + } + + /** + * Get the provisioningState property: Status of diagnostic provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the diagnostics property: Array of Diagnostics. + * + * @return the diagnostics value. + */ + public List diagnostics() { + return this.innerProperties() == null ? null : this.innerProperties().diagnostics(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceProperties.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceProperties.java new file mode 100644 index 0000000000000..40208f9fcb864 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/DiagnosticResourceProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.selfhelp.models.Diagnostic; +import com.azure.resourcemanager.selfhelp.models.DiagnosticInvocation; +import com.azure.resourcemanager.selfhelp.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Diagnostic resource properties. */ +@Fluent +public final class DiagnosticResourceProperties { + /* + * Global parameters that can be passed to all solutionIds. + */ + @JsonProperty(value = "globalParameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map globalParameters; + + /* + * SolutionIds that are needed to be invoked. + */ + @JsonProperty(value = "insights") + private List insights; + + /* + * Diagnostic Request Accepted time. + */ + @JsonProperty(value = "acceptedAt", access = JsonProperty.Access.WRITE_ONLY) + private String acceptedAt; + + /* + * Status of diagnostic provisioning. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Array of Diagnostics. + */ + @JsonProperty(value = "diagnostics", access = JsonProperty.Access.WRITE_ONLY) + private List diagnostics; + + /** Creates an instance of DiagnosticResourceProperties class. */ + public DiagnosticResourceProperties() { + } + + /** + * Get the globalParameters property: Global parameters that can be passed to all solutionIds. + * + * @return the globalParameters value. + */ + public Map globalParameters() { + return this.globalParameters; + } + + /** + * Set the globalParameters property: Global parameters that can be passed to all solutionIds. + * + * @param globalParameters the globalParameters value to set. + * @return the DiagnosticResourceProperties object itself. + */ + public DiagnosticResourceProperties withGlobalParameters(Map globalParameters) { + this.globalParameters = globalParameters; + return this; + } + + /** + * Get the insights property: SolutionIds that are needed to be invoked. + * + * @return the insights value. + */ + public List insights() { + return this.insights; + } + + /** + * Set the insights property: SolutionIds that are needed to be invoked. + * + * @param insights the insights value to set. + * @return the DiagnosticResourceProperties object itself. + */ + public DiagnosticResourceProperties withInsights(List insights) { + this.insights = insights; + return this; + } + + /** + * Get the acceptedAt property: Diagnostic Request Accepted time. + * + * @return the acceptedAt value. + */ + public String acceptedAt() { + return this.acceptedAt; + } + + /** + * Get the provisioningState property: Status of diagnostic provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the diagnostics property: Array of Diagnostics. + * + * @return the diagnostics value. + */ + public List diagnostics() { + return this.diagnostics; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (insights() != null) { + insights().forEach(e -> e.validate()); + } + if (diagnostics() != null) { + diagnostics().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/OperationInner.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..a473f7fbc1f85 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.selfhelp.models.ActionType; +import com.azure.resourcemanager.selfhelp.models.OperationDisplay; +import com.azure.resourcemanager.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataProperties.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataProperties.java new file mode 100644 index 0000000000000..73bf10a0dd2e9 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Diagnostic solution metadata. */ +@Fluent +public final class SolutionMetadataProperties { + /* + * Solution Id. + */ + @JsonProperty(value = "solutionId") + private String solutionId; + + /* + * Solution Type. + */ + @JsonProperty(value = "solutionType") + private String solutionType; + + /* + * A detailed description of solution. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Required parameters for invoking this particular solution. + */ + @JsonProperty(value = "requiredParameterSets") + private List> requiredParameterSets; + + /** Creates an instance of SolutionMetadataProperties class. */ + public SolutionMetadataProperties() { + } + + /** + * Get the solutionId property: Solution Id. + * + * @return the solutionId value. + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Set the solutionId property: Solution Id. + * + * @param solutionId the solutionId value to set. + * @return the SolutionMetadataProperties object itself. + */ + public SolutionMetadataProperties withSolutionId(String solutionId) { + this.solutionId = solutionId; + return this; + } + + /** + * Get the solutionType property: Solution Type. + * + * @return the solutionType value. + */ + public String solutionType() { + return this.solutionType; + } + + /** + * Set the solutionType property: Solution Type. + * + * @param solutionType the solutionType value to set. + * @return the SolutionMetadataProperties object itself. + */ + public SolutionMetadataProperties withSolutionType(String solutionType) { + this.solutionType = solutionType; + return this; + } + + /** + * Get the description property: A detailed description of solution. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A detailed description of solution. + * + * @param description the description value to set. + * @return the SolutionMetadataProperties object itself. + */ + public SolutionMetadataProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the requiredParameterSets property: Required parameters for invoking this particular solution. + * + * @return the requiredParameterSets value. + */ + public List> requiredParameterSets() { + return this.requiredParameterSets; + } + + /** + * Set the requiredParameterSets property: Required parameters for invoking this particular solution. + * + * @param requiredParameterSets the requiredParameterSets value to set. + * @return the SolutionMetadataProperties object itself. + */ + public SolutionMetadataProperties withRequiredParameterSets(List> requiredParameterSets) { + this.requiredParameterSets = requiredParameterSets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataResourceInner.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataResourceInner.java new file mode 100644 index 0000000000000..ad82b78369ca2 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/SolutionMetadataResourceInner.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Solution Metadata resource. */ +@Fluent +public final class SolutionMetadataResourceInner extends ProxyResource { + /* + * Solution metadata Resource properties. + */ + @JsonProperty(value = "properties") + private SolutionMetadataProperties 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 SolutionMetadataResourceInner class. */ + public SolutionMetadataResourceInner() { + } + + /** + * Get the innerProperties property: Solution metadata Resource properties. + * + * @return the innerProperties value. + */ + private SolutionMetadataProperties 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 solutionId property: Solution Id. + * + * @return the solutionId value. + */ + public String solutionId() { + return this.innerProperties() == null ? null : this.innerProperties().solutionId(); + } + + /** + * Set the solutionId property: Solution Id. + * + * @param solutionId the solutionId value to set. + * @return the SolutionMetadataResourceInner object itself. + */ + public SolutionMetadataResourceInner withSolutionId(String solutionId) { + if (this.innerProperties() == null) { + this.innerProperties = new SolutionMetadataProperties(); + } + this.innerProperties().withSolutionId(solutionId); + return this; + } + + /** + * Get the solutionType property: Solution Type. + * + * @return the solutionType value. + */ + public String solutionType() { + return this.innerProperties() == null ? null : this.innerProperties().solutionType(); + } + + /** + * Set the solutionType property: Solution Type. + * + * @param solutionType the solutionType value to set. + * @return the SolutionMetadataResourceInner object itself. + */ + public SolutionMetadataResourceInner withSolutionType(String solutionType) { + if (this.innerProperties() == null) { + this.innerProperties = new SolutionMetadataProperties(); + } + this.innerProperties().withSolutionType(solutionType); + return this; + } + + /** + * Get the description property: A detailed description of solution. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A detailed description of solution. + * + * @param description the description value to set. + * @return the SolutionMetadataResourceInner object itself. + */ + public SolutionMetadataResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new SolutionMetadataProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the requiredParameterSets property: Required parameters for invoking this particular solution. + * + * @return the requiredParameterSets value. + */ + public List> requiredParameterSets() { + return this.innerProperties() == null ? null : this.innerProperties().requiredParameterSets(); + } + + /** + * Set the requiredParameterSets property: Required parameters for invoking this particular solution. + * + * @param requiredParameterSets the requiredParameterSets value to set. + * @return the SolutionMetadataResourceInner object itself. + */ + public SolutionMetadataResourceInner withRequiredParameterSets(List> requiredParameterSets) { + if (this.innerProperties() == null) { + this.innerProperties = new SolutionMetadataProperties(); + } + this.innerProperties().withRequiredParameterSets(requiredParameterSets); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/package-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/models/package-info.java new file mode 100644 index 0000000000000..02c88d2a20cd7 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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 HelpRP. Help RP provider. */ +package com.azure.resourcemanager.selfhelp.fluent.models; diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/package-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/fluent/package-info.java new file mode 100644 index 0000000000000..e9c3d48563024 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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 HelpRP. Help RP provider. */ +package com.azure.resourcemanager.selfhelp.fluent; diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..a3f69f36a547a --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.implementation; + +import com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticResourceImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticResourceImpl.java new file mode 100644 index 0000000000000..fe51ee8b42ed4 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticResourceImpl.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import com.azure.resourcemanager.selfhelp.models.Diagnostic; +import com.azure.resourcemanager.selfhelp.models.DiagnosticInvocation; +import com.azure.resourcemanager.selfhelp.models.DiagnosticResource; +import com.azure.resourcemanager.selfhelp.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DiagnosticResourceImpl implements DiagnosticResource, DiagnosticResource.Definition { + private DiagnosticResourceInner innerObject; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + DiagnosticResourceImpl( + DiagnosticResourceInner innerObject, com.azure.resourcemanager.selfhelp.SelfHelpManager 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 Map globalParameters() { + Map inner = this.innerModel().globalParameters(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List insights() { + List inner = this.innerModel().insights(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String acceptedAt() { + return this.innerModel().acceptedAt(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List diagnostics() { + List inner = this.innerModel().diagnostics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } + + private String scope; + + private String diagnosticsResourceName; + + public DiagnosticResourceImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public DiagnosticResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnostics() + .create(scope, diagnosticsResourceName, this.innerModel(), Context.NONE); + return this; + } + + public DiagnosticResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnostics() + .create(scope, diagnosticsResourceName, this.innerModel(), context); + return this; + } + + DiagnosticResourceImpl(String name, com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager) { + this.innerObject = new DiagnosticResourceInner(); + this.serviceManager = serviceManager; + this.diagnosticsResourceName = name; + } + + public DiagnosticResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnostics() + .getWithResponse(scope, diagnosticsResourceName, Context.NONE) + .getValue(); + return this; + } + + public DiagnosticResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnostics() + .getWithResponse(scope, diagnosticsResourceName, context) + .getValue(); + return this; + } + + public DiagnosticResourceImpl withGlobalParameters(Map globalParameters) { + this.innerModel().withGlobalParameters(globalParameters); + return this; + } + + public DiagnosticResourceImpl withInsights(List insights) { + this.innerModel().withInsights(insights); + return this; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsClientImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsClientImpl.java new file mode 100644 index 0000000000000..bf1548f47f228 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsClientImpl.java @@ -0,0 +1,725 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.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.selfhelp.fluent.DiagnosticsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; +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 DiagnosticsClient. */ +public final class DiagnosticsClientImpl implements DiagnosticsClient { + /** The proxy service used to perform REST calls. */ + private final DiagnosticsService service; + + /** The service client containing this operation class. */ + private final HelpRPImpl client; + + /** + * Initializes an instance of DiagnosticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiagnosticsClientImpl(HelpRPImpl client) { + this.service = + RestProxy.create(DiagnosticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HelpRPDiagnostics to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HelpRPDiagnostics") + public interface DiagnosticsService { + @Headers({"Content-Type: application/json"}) + @Post("/{scope}/providers/Microsoft.Help/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest checkNameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("diagnosticsResourceName") String diagnosticsResourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiagnosticResourceInner diagnosticResourceRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("diagnosticsResourceName") String diagnosticsResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param checkNameAvailabilityRequest The required parameters for availability check. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (checkNameAvailabilityRequest != null) { + checkNameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + checkNameAvailabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param checkNameAvailabilityRequest The required parameters for availability check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (checkNameAvailabilityRequest != null) { + checkNameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + checkNameAvailabilityRequest, + accept, + context); + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String scope) { + final CheckNameAvailabilityRequest checkNameAvailabilityRequest = null; + return checkNameAvailabilityWithResponseAsync(scope, checkNameAvailabilityRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param checkNameAvailabilityRequest The required parameters for availability check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(scope, checkNameAvailabilityRequest, context).block(); + } + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(String scope) { + final CheckNameAvailabilityRequest checkNameAvailabilityRequest = null; + return checkNameAvailabilityWithResponse(scope, checkNameAvailabilityRequest, Context.NONE).getValue(); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return diagnostic resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String scope, String diagnosticsResourceName, DiagnosticResourceInner diagnosticResourceRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (diagnosticsResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter diagnosticsResourceName is required and cannot be null.")); + } + if (diagnosticResourceRequest != null) { + diagnosticResourceRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + scope, + diagnosticsResourceName, + this.client.getApiVersion(), + diagnosticResourceRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (diagnosticsResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter diagnosticsResourceName is required and cannot be null.")); + } + if (diagnosticResourceRequest != null) { + diagnosticResourceRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + scope, + diagnosticsResourceName, + this.client.getApiVersion(), + diagnosticResourceRequest, + accept, + context); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiagnosticResourceInner> beginCreateAsync( + String scope, String diagnosticsResourceName, DiagnosticResourceInner diagnosticResourceRequest) { + Mono>> mono = + createWithResponseAsync(scope, diagnosticsResourceName, diagnosticResourceRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiagnosticResourceInner.class, + DiagnosticResourceInner.class, + this.client.getContext()); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiagnosticResourceInner> beginCreateAsync( + String scope, String diagnosticsResourceName) { + final DiagnosticResourceInner diagnosticResourceRequest = null; + Mono>> mono = + createWithResponseAsync(scope, diagnosticsResourceName, diagnosticResourceRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiagnosticResourceInner.class, + DiagnosticResourceInner.class, + this.client.getContext()); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiagnosticResourceInner> beginCreateAsync( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(scope, diagnosticsResourceName, diagnosticResourceRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiagnosticResourceInner.class, + DiagnosticResourceInner.class, + context); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiagnosticResourceInner> beginCreate( + String scope, String diagnosticsResourceName) { + final DiagnosticResourceInner diagnosticResourceRequest = null; + return this.beginCreateAsync(scope, diagnosticsResourceName, diagnosticResourceRequest).getSyncPoller(); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiagnosticResourceInner> beginCreate( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context) { + return this + .beginCreateAsync(scope, diagnosticsResourceName, diagnosticResourceRequest, context) + .getSyncPoller(); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return diagnostic resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String scope, String diagnosticsResourceName, DiagnosticResourceInner diagnosticResourceRequest) { + return beginCreateAsync(scope, diagnosticsResourceName, diagnosticResourceRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return diagnostic resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String scope, String diagnosticsResourceName) { + final DiagnosticResourceInner diagnosticResourceRequest = null; + return beginCreateAsync(scope, diagnosticsResourceName, diagnosticResourceRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context) { + return beginCreateAsync(scope, diagnosticsResourceName, diagnosticResourceRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticResourceInner create(String scope, String diagnosticsResourceName) { + final DiagnosticResourceInner diagnosticResourceRequest = null; + return createAsync(scope, diagnosticsResourceName, diagnosticResourceRequest).block(); + } + + /** + * Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once + * you discover and identify the relevant solution for your Azure issue.<br/><br/> You can create + * diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ + * <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API response + * must be passed via ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @param diagnosticResourceRequest The required request body for this insightResource invocation. + * @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 diagnostic resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticResourceInner create( + String scope, + String diagnosticsResourceName, + DiagnosticResourceInner diagnosticResourceRequest, + Context context) { + return createAsync(scope, diagnosticsResourceName, diagnosticResourceRequest, context).block(); + } + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String diagnosticsResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (diagnosticsResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter diagnosticsResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + diagnosticsResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @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 diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String diagnosticsResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (diagnosticsResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter diagnosticsResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + scope, + diagnosticsResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String diagnosticsResourceName) { + return getWithResponseAsync(scope, diagnosticsResourceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @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 diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String diagnosticsResourceName, Context context) { + return getWithResponseAsync(scope, diagnosticsResourceName, context).block(); + } + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticResourceInner get(String scope, String diagnosticsResourceName) { + return getWithResponse(scope, diagnosticsResourceName, Context.NONE).getValue(); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsImpl.java new file mode 100644 index 0000000000000..2420857a3ef89 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiagnosticsImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.selfhelp.fluent.DiagnosticsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.selfhelp.models.DiagnosticResource; +import com.azure.resourcemanager.selfhelp.models.Diagnostics; + +public final class DiagnosticsImpl implements Diagnostics { + private static final ClientLogger LOGGER = new ClientLogger(DiagnosticsImpl.class); + + private final DiagnosticsClient innerClient; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + public DiagnosticsImpl( + DiagnosticsClient innerClient, com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkNameAvailabilityWithResponse( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(scope, checkNameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkNameAvailability(String scope) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(scope); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String scope, String diagnosticsResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, diagnosticsResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiagnosticResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiagnosticResource get(String scope, String diagnosticsResourceName) { + DiagnosticResourceInner inner = this.serviceClient().get(scope, diagnosticsResourceName); + if (inner != null) { + return new DiagnosticResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public DiagnosticResource getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String diagnosticsResourceName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", + "diagnosticsResourceName"); + if (diagnosticsResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diagnostics'.", id))); + } + return this.getWithResponse(scope, diagnosticsResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String diagnosticsResourceName = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.Help/diagnostics/{diagnosticsResourceName}", + "diagnosticsResourceName"); + if (diagnosticsResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'diagnostics'.", id))); + } + return this.getWithResponse(scope, diagnosticsResourceName, context); + } + + private DiagnosticsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } + + public DiagnosticResourceImpl define(String name) { + return new DiagnosticResourceImpl(name, this.manager()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsClientImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsClientImpl.java new file mode 100644 index 0000000000000..b7743fbde3111 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsClientImpl.java @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.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.selfhelp.fluent.DiscoverySolutionsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import com.azure.resourcemanager.selfhelp.models.DiscoveryResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiscoverySolutionsClient. */ +public final class DiscoverySolutionsClientImpl implements DiscoverySolutionsClient { + /** The proxy service used to perform REST calls. */ + private final DiscoverySolutionsService service; + + /** The service client containing this operation class. */ + private final HelpRPImpl client; + + /** + * Initializes an instance of DiscoverySolutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiscoverySolutionsClientImpl(HelpRPImpl client) { + this.service = + RestProxy.create(DiscoverySolutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HelpRPDiscoverySolutions to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HelpRPDiscoverySolut") + public interface DiscoverySolutionsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.Help/discoverySolutions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @QueryParam(value = "$filter", encoded = true) String filter, + @QueryParam("$skiptoken") String skiptoken, + @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); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + this.client.getApiVersion(), + filter, + skiptoken, + 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())); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 discovery response along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), scope, this.client.getApiVersion(), filter, skiptoken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, skiptoken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String filter = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, skiptoken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 discovery response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, String filter, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, skiptoken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String filter = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(scope, filter, skiptoken)); + } + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 discovery response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, String filter, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(scope, filter, skiptoken, 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 discovery response 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 discovery response 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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsImpl.java new file mode 100644 index 0000000000000..6519904cd1eed --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/DiscoverySolutionsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.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.selfhelp.fluent.DiscoverySolutionsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import com.azure.resourcemanager.selfhelp.models.DiscoverySolutions; +import com.azure.resourcemanager.selfhelp.models.SolutionMetadataResource; + +public final class DiscoverySolutionsImpl implements DiscoverySolutions { + private static final ClientLogger LOGGER = new ClientLogger(DiscoverySolutionsImpl.class); + + private final DiscoverySolutionsClient innerClient; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + public DiscoverySolutionsImpl( + DiscoverySolutionsClient innerClient, com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new SolutionMetadataResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, String filter, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, filter, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new SolutionMetadataResourceImpl(inner1, this.manager())); + } + + private DiscoverySolutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPBuilder.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPBuilder.java new file mode 100644 index 0000000000000..292dbc6bc364b --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.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 HelpRPImpl type. */ +@ServiceClientBuilder(serviceClients = {HelpRPImpl.class}) +public final class HelpRPBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the HelpRPBuilder. + */ + public HelpRPBuilder 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 HelpRPBuilder. + */ + public HelpRPBuilder 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 HelpRPBuilder. + */ + public HelpRPBuilder 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 HelpRPBuilder. + */ + public HelpRPBuilder 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 HelpRPBuilder. + */ + public HelpRPBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of HelpRPImpl with the provided parameters. + * + * @return an instance of HelpRPImpl. + */ + public HelpRPImpl 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(); + HelpRPImpl client = + new HelpRPImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPImpl.java new file mode 100644 index 0000000000000..49c34740b87f3 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/HelpRPImpl.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.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.selfhelp.fluent.DiagnosticsClient; +import com.azure.resourcemanager.selfhelp.fluent.DiscoverySolutionsClient; +import com.azure.resourcemanager.selfhelp.fluent.HelpRP; +import com.azure.resourcemanager.selfhelp.fluent.OperationsClient; +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 HelpRPImpl type. */ +@ServiceClient(builder = HelpRPBuilder.class) +public final class HelpRPImpl implements HelpRP { + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The DiagnosticsClient object to access its operations. */ + private final DiagnosticsClient diagnostics; + + /** + * Gets the DiagnosticsClient object to access its operations. + * + * @return the DiagnosticsClient object. + */ + public DiagnosticsClient getDiagnostics() { + return this.diagnostics; + } + + /** The DiscoverySolutionsClient object to access its operations. */ + private final DiscoverySolutionsClient discoverySolutions; + + /** + * Gets the DiscoverySolutionsClient object to access its operations. + * + * @return the DiscoverySolutionsClient object. + */ + public DiscoverySolutionsClient getDiscoverySolutions() { + return this.discoverySolutions; + } + + /** + * Initializes an instance of HelpRP 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 endpoint server parameter. + */ + HelpRPImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2023-01-01-preview"; + this.operations = new OperationsClientImpl(this); + this.diagnostics = new DiagnosticsClientImpl(this); + this.discoverySolutions = new DiscoverySolutionsClientImpl(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(HelpRPImpl.class); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationImpl.java new file mode 100644 index 0000000000000..6157497279739 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.implementation; + +import com.azure.resourcemanager.selfhelp.fluent.models.OperationInner; +import com.azure.resourcemanager.selfhelp.models.ActionType; +import com.azure.resourcemanager.selfhelp.models.Operation; +import com.azure.resourcemanager.selfhelp.models.OperationDisplay; +import com.azure.resourcemanager.selfhelp.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.selfhelp.SelfHelpManager 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.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsClientImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..d6945177ff33a --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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.selfhelp.fluent.OperationsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.OperationInner; +import com.azure.resourcemanager.selfhelp.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 HelpRPImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(HelpRPImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HelpRPOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HelpRPOperations") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Help/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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5a1d26da9cabf --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.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.selfhelp.fluent.OperationsClient; +import com.azure.resourcemanager.selfhelp.fluent.models.OperationInner; +import com.azure.resourcemanager.selfhelp.models.Operation; +import com.azure.resourcemanager.selfhelp.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.selfhelp.SelfHelpManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.selfhelp.SelfHelpManager 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.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/SolutionMetadataResourceImpl.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/SolutionMetadataResourceImpl.java new file mode 100644 index 0000000000000..56862112fcba3 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/SolutionMetadataResourceImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import com.azure.resourcemanager.selfhelp.models.SolutionMetadataResource; +import java.util.Collections; +import java.util.List; + +public final class SolutionMetadataResourceImpl implements SolutionMetadataResource { + private SolutionMetadataResourceInner innerObject; + + private final com.azure.resourcemanager.selfhelp.SelfHelpManager serviceManager; + + SolutionMetadataResourceImpl( + SolutionMetadataResourceInner innerObject, com.azure.resourcemanager.selfhelp.SelfHelpManager 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 solutionId() { + return this.innerModel().solutionId(); + } + + public String solutionType() { + return this.innerModel().solutionType(); + } + + public String description() { + return this.innerModel().description(); + } + + public List> requiredParameterSets() { + List> inner = this.innerModel().requiredParameterSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SolutionMetadataResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.selfhelp.SelfHelpManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/Utils.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/Utils.java new file mode 100644 index 0000000000000..ea9d8cff22e75 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/package-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/implementation/package-info.java new file mode 100644 index 0000000000000..8614038dd2d5d --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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 HelpRP. Help RP provider. */ +package com.azure.resourcemanager.selfhelp.implementation; diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ActionType.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ActionType.java new file mode 100644 index 0000000000000..277b10c6754d0 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityRequest.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..69242854879c3 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability request body. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityResponse.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..4bd3f8d3fa584 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/CheckNameAvailabilityResponse.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.selfhelp.models; + +import com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Returns true or false depending on the availability of the name. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Reason for why value is not available. This field is returned if nameAvailable is + * false. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the message property: Gets an error message explaining the 'reason' value with more details. This field is + * returned iif nameAvailable is false. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostic.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostic.java new file mode 100644 index 0000000000000..aa93ac8396633 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostic.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties returned with in an insight. */ +@Fluent +public final class Diagnostic { + /* + * Solution Id + */ + @JsonProperty(value = "solutionId") + private String solutionId; + + /* + * Denotes the status of the diagnostic resource. + */ + @JsonProperty(value = "status") + private Status status; + + /* + * The problems (if any) detected by this insight. + */ + @JsonProperty(value = "insights") + private List insights; + + /* + * Error definition. + */ + @JsonProperty(value = "error") + private Error error; + + /** Creates an instance of Diagnostic class. */ + public Diagnostic() { + } + + /** + * Get the solutionId property: Solution Id. + * + * @return the solutionId value. + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Set the solutionId property: Solution Id. + * + * @param solutionId the solutionId value to set. + * @return the Diagnostic object itself. + */ + public Diagnostic withSolutionId(String solutionId) { + this.solutionId = solutionId; + return this; + } + + /** + * Get the status property: Denotes the status of the diagnostic resource. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: Denotes the status of the diagnostic resource. + * + * @param status the status value to set. + * @return the Diagnostic object itself. + */ + public Diagnostic withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the insights property: The problems (if any) detected by this insight. + * + * @return the insights value. + */ + public List insights() { + return this.insights; + } + + /** + * Set the insights property: The problems (if any) detected by this insight. + * + * @param insights the insights value to set. + * @return the Diagnostic object itself. + */ + public Diagnostic withInsights(List insights) { + this.insights = insights; + return this; + } + + /** + * Get the error property: Error definition. + * + * @return the error value. + */ + public Error error() { + return this.error; + } + + /** + * Set the error property: Error definition. + * + * @param error the error value to set. + * @return the Diagnostic object itself. + */ + public Diagnostic withError(Error error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (insights() != null) { + insights().forEach(e -> e.validate()); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticInvocation.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticInvocation.java new file mode 100644 index 0000000000000..e00cd103e86ea --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticInvocation.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Solution Invocation with additional params needed for invocation. */ +@Fluent +public final class DiagnosticInvocation { + /* + * Solution Id to invoke. + */ + @JsonProperty(value = "solutionId") + private String solutionId; + + /* + * Additional parameters required to invoke the solutionId. + */ + @JsonProperty(value = "additionalParameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map additionalParameters; + + /** Creates an instance of DiagnosticInvocation class. */ + public DiagnosticInvocation() { + } + + /** + * Get the solutionId property: Solution Id to invoke. + * + * @return the solutionId value. + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Set the solutionId property: Solution Id to invoke. + * + * @param solutionId the solutionId value to set. + * @return the DiagnosticInvocation object itself. + */ + public DiagnosticInvocation withSolutionId(String solutionId) { + this.solutionId = solutionId; + return this; + } + + /** + * Get the additionalParameters property: Additional parameters required to invoke the solutionId. + * + * @return the additionalParameters value. + */ + public Map additionalParameters() { + return this.additionalParameters; + } + + /** + * Set the additionalParameters property: Additional parameters required to invoke the solutionId. + * + * @param additionalParameters the additionalParameters value to set. + * @return the DiagnosticInvocation object itself. + */ + public DiagnosticInvocation withAdditionalParameters(Map additionalParameters) { + this.additionalParameters = additionalParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticResource.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticResource.java new file mode 100644 index 0000000000000..6a6ba682ac860 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiagnosticResource.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DiagnosticResource. */ +public interface DiagnosticResource { + /** + * 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 globalParameters property: Global parameters that can be passed to all solutionIds. + * + * @return the globalParameters value. + */ + Map globalParameters(); + + /** + * Gets the insights property: SolutionIds that are needed to be invoked. + * + * @return the insights value. + */ + List insights(); + + /** + * Gets the acceptedAt property: Diagnostic Request Accepted time. + * + * @return the acceptedAt value. + */ + String acceptedAt(); + + /** + * Gets the provisioningState property: Status of diagnostic provisioning. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the diagnostics property: Array of Diagnostics. + * + * @return the diagnostics value. + */ + List diagnostics(); + + /** + * Gets the inner com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner object. + * + * @return the inner object. + */ + DiagnosticResourceInner innerModel(); + + /** The entirety of the DiagnosticResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The DiagnosticResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DiagnosticResource definition. */ + interface Blank extends WithScope { + } + /** The stage of the DiagnosticResource definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the + * moment. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the DiagnosticResource 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.WithGlobalParameters, DefinitionStages.WithInsights { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiagnosticResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiagnosticResource create(Context context); + } + /** The stage of the DiagnosticResource definition allowing to specify globalParameters. */ + interface WithGlobalParameters { + /** + * Specifies the globalParameters property: Global parameters that can be passed to all solutionIds.. + * + * @param globalParameters Global parameters that can be passed to all solutionIds. + * @return the next definition stage. + */ + WithCreate withGlobalParameters(Map globalParameters); + } + /** The stage of the DiagnosticResource definition allowing to specify insights. */ + interface WithInsights { + /** + * Specifies the insights property: SolutionIds that are needed to be invoked.. + * + * @param insights SolutionIds that are needed to be invoked. + * @return the next definition stage. + */ + WithCreate withInsights(List insights); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiagnosticResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiagnosticResource refresh(Context context); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostics.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostics.java new file mode 100644 index 0000000000000..948d00e3d6eb4 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Diagnostics.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Diagnostics. */ +public interface Diagnostics { + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param checkNameAvailabilityRequest The required parameters for availability check. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + String scope, CheckNameAvailabilityRequest checkNameAvailabilityRequest, Context context); + + /** + * This API is used to check the uniqueness of a resource name used for a diagnostic check. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response for whether the requested resource name is available or not. + */ + CheckNameAvailabilityResponse checkNameAvailability(String scope); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @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 diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response}. + */ + Response getWithResponse(String scope, String diagnosticsResourceName, Context context); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param diagnosticsResourceName Unique resource name for insight resources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + */ + DiagnosticResource get(String scope, String diagnosticsResourceName); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response}. + */ + DiagnosticResource getById(String id); + + /** + * Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DiagnosticResource resource. + * + * @param name resource name. + * @return the first stage of the new DiagnosticResource definition. + */ + DiagnosticResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoveryResponse.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoveryResponse.java new file mode 100644 index 0000000000000..1592d58be2878 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoveryResponse.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.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Discovery response. */ +@Fluent +public final class DiscoveryResponse { + /* + * The list of solution metadata. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of solution metadata. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DiscoveryResponse class. */ + public DiscoveryResponse() { + } + + /** + * Get the value property: The list of solution metadata. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of solution metadata. + * + * @param value the value value to set. + * @return the DiscoveryResponse object itself. + */ + public DiscoveryResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of solution metadata. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of solution metadata. + * + * @param nextLink the nextLink value to set. + * @return the DiscoveryResponse object itself. + */ + public DiscoveryResponse 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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoverySolutions.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoverySolutions.java new file mode 100644 index 0000000000000..92f2a9a37eef3 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/DiscoverySolutions.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DiscoverySolutions. */ +public interface DiscoverySolutions { + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant + * solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR resourceUri + * + problemClassificationId.<br/><br/>We will do our best in returning relevant diagnostics for your + * Azure issue.<br/><br/> Get the problemClassificationId(s) using this + * [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/> + * <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via + * ‘additionalParameters’ as an input to Diagnostics API. + * + * @param scope This is an extension resource provider and only resource level extension is supported at the moment. + * @param filter Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and + * 'eq' operators. Example: $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e' and + * ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that + * specifies a starting point to use for subsequent calls. + * @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 discovery response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope, String filter, String skiptoken, Context context); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Error.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Error.java new file mode 100644 index 0000000000000..d2222309563eb --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Error.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Error definition. */ +@Fluent +public final class Error { + /* + * Service specific error code which serves as the substatus for the HTTP error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * Service specific error type which serves as additional context for the error herein. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Description of the error. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * An array of additional nested error response info objects, as described by this contract. + */ + @JsonProperty(value = "details") + private List details; + + /** Creates an instance of Error class. */ + public Error() { + } + + /** + * Get the code property: Service specific error code which serves as the substatus for the HTTP error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the type property: Service specific error type which serves as additional context for the error herein. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the message property: Description of the error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the details property: An array of additional nested error response info objects, as described by this + * contract. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: An array of additional nested error response info objects, as described by this + * contract. + * + * @param details the details value to set. + * @return the Error object itself. + */ + public Error withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (details() != null) { + details().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ImportanceLevel.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ImportanceLevel.java new file mode 100644 index 0000000000000..f06fc5b49b78f --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ImportanceLevel.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.selfhelp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Importance level of the insight. */ +public final class ImportanceLevel extends ExpandableStringEnum { + /** Static value Critical for ImportanceLevel. */ + public static final ImportanceLevel CRITICAL = fromString("Critical"); + + /** Static value Warning for ImportanceLevel. */ + public static final ImportanceLevel WARNING = fromString("Warning"); + + /** Static value Information for ImportanceLevel. */ + public static final ImportanceLevel INFORMATION = fromString("Information"); + + /** + * Creates a new instance of ImportanceLevel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ImportanceLevel() { + } + + /** + * Creates or finds a ImportanceLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImportanceLevel. + */ + @JsonCreator + public static ImportanceLevel fromString(String name) { + return fromString(name, ImportanceLevel.class); + } + + /** + * Gets known ImportanceLevel values. + * + * @return known ImportanceLevel values. + */ + public static Collection values() { + return values(ImportanceLevel.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Insight.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Insight.java new file mode 100644 index 0000000000000..e0154a4833c05 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Insight.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Detailed insights(s) obtained via the invocation of an insight diagnostic troubleshooter. */ +@Fluent +public final class Insight { + /* + * Article id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * This insight's title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * Detailed result content. + */ + @JsonProperty(value = "results") + private String results; + + /* + * Importance level of the insight. + */ + @JsonProperty(value = "importanceLevel") + private ImportanceLevel importanceLevel; + + /** Creates an instance of Insight class. */ + public Insight() { + } + + /** + * Get the id property: Article id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Article id. + * + * @param id the id value to set. + * @return the Insight object itself. + */ + public Insight withId(String id) { + this.id = id; + return this; + } + + /** + * Get the title property: This insight's title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: This insight's title. + * + * @param title the title value to set. + * @return the Insight object itself. + */ + public Insight withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the results property: Detailed result content. + * + * @return the results value. + */ + public String results() { + return this.results; + } + + /** + * Set the results property: Detailed result content. + * + * @param results the results value to set. + * @return the Insight object itself. + */ + public Insight withResults(String results) { + this.results = results; + return this; + } + + /** + * Get the importanceLevel property: Importance level of the insight. + * + * @return the importanceLevel value. + */ + public ImportanceLevel importanceLevel() { + return this.importanceLevel; + } + + /** + * Set the importanceLevel property: Importance level of the insight. + * + * @param importanceLevel the importanceLevel value to set. + * @return the Insight object itself. + */ + public Insight withImportanceLevel(ImportanceLevel importanceLevel) { + this.importanceLevel = importanceLevel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operation.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operation.java new file mode 100644 index 0000000000000..47822f3990ca6 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.models; + +import com.azure.resourcemanager.selfhelp.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.selfhelp.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationDisplay.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationDisplay.java new file mode 100644 index 0000000000000..2143c57e4376a --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationListResult.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/OperationListResult.java new file mode 100644 index 0000000000000..260768895a36a --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operations.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Operations.java new file mode 100644 index 0000000000000..c92ebc23ca6f5 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Origin.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Origin.java new file mode 100644 index 0000000000000..ac77c6d780465 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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.selfhelp.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/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ProvisioningState.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ProvisioningState.java new file mode 100644 index 0000000000000..94a37ebafff17 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/ProvisioningState.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.selfhelp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status of diagnostic provisioning. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value PartialComplete for ProvisioningState. */ + public static final ProvisioningState PARTIAL_COMPLETE = fromString("PartialComplete"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/SolutionMetadataResource.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/SolutionMetadataResource.java new file mode 100644 index 0000000000000..a6e5a66156d9b --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/SolutionMetadataResource.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import java.util.List; + +/** An immutable client-side representation of SolutionMetadataResource. */ +public interface SolutionMetadataResource { + /** + * 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 solutionId property: Solution Id. + * + * @return the solutionId value. + */ + String solutionId(); + + /** + * Gets the solutionType property: Solution Type. + * + * @return the solutionType value. + */ + String solutionType(); + + /** + * Gets the description property: A detailed description of solution. + * + * @return the description value. + */ + String description(); + + /** + * Gets the requiredParameterSets property: Required parameters for invoking this particular solution. + * + * @return the requiredParameterSets value. + */ + List> requiredParameterSets(); + + /** + * Gets the inner com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner object. + * + * @return the inner object. + */ + SolutionMetadataResourceInner innerModel(); +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Status.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Status.java new file mode 100644 index 0000000000000..20a04b5a985fd --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/Status.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.selfhelp.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Denotes the status of the diagnostic resource. */ +public final class Status extends ExpandableStringEnum { + /** Static value Failed for Status. */ + public static final Status FAILED = fromString("Failed"); + + /** Static value MissingInputs for Status. */ + public static final Status MISSING_INPUTS = fromString("MissingInputs"); + + /** Static value Running for Status. */ + public static final Status RUNNING = fromString("Running"); + + /** Static value Succeeded for Status. */ + public static final Status SUCCEEDED = fromString("Succeeded"); + + /** Static value Timeout for Status. */ + public static final Status TIMEOUT = fromString("Timeout"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/package-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/models/package-info.java new file mode 100644 index 0000000000000..37e52cd7136bb --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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 HelpRP. Help RP provider. */ +package com.azure.resourcemanager.selfhelp.models; diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/package-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/package-info.java new file mode 100644 index 0000000000000..96f3972777975 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/com/azure/resourcemanager/selfhelp/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 HelpRP. Help RP provider. */ +package com.azure.resourcemanager.selfhelp; diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/module-info.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/main/java/module-info.java new file mode 100644 index 0000000000000..b027169c072c7 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/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.selfhelp { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.selfhelp; + exports com.azure.resourcemanager.selfhelp.fluent; + exports com.azure.resourcemanager.selfhelp.fluent.models; + exports com.azure.resourcemanager.selfhelp.models; + + opens com.azure.resourcemanager.selfhelp.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.selfhelp.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilitySamples.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..0234cb25f6d4b --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilitySamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; + +/** Samples for Diagnostics CheckNameAvailability. */ +public final class DiagnosticsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsNotAvailable.json + */ + /** + * Sample code: Example when name is not available for a Diagnostic resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void exampleWhenNameIsNotAvailableForADiagnosticResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .checkNameAvailabilityWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", + new CheckNameAvailabilityRequest().withName("sampleName").withType("Microsoft.Help/diagnostics"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CheckNameAvailabilityForDiagnosticWhenNameIsAvailable.json + */ + /** + * Sample code: Example when name is available for a Diagnostic resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void exampleWhenNameIsAvailableForADiagnosticResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .checkNameAvailabilityWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", + new CheckNameAvailabilityRequest().withName("sampleName").withType("Microsoft.Help/diagnostics"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCreateSamples.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCreateSamples.java new file mode 100644 index 0000000000000..fc8eed4be6ff5 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCreateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +/** Samples for Diagnostics Create. */ +public final class DiagnosticsCreateSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/CreateDiagnosticForKeyVaultResource.json + */ + /** + * Sample code: Creates a Diagnostic for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void createsADiagnosticForAKeyVaultResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .define("VMNotWorkingInsight") + .withExistingScope( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read") + .create(); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetSamples.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetSamples.java new file mode 100644 index 0000000000000..cfeb748f0b307 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetSamples.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.selfhelp.generated; + +/** Samples for Diagnostics Get. */ +public final class DiagnosticsGetSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/GetDiagnosticForKeyVaultResource.json + */ + /** + * Sample code: Gets a Diagnostic for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void getsADiagnosticForAKeyVaultResource(com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .diagnostics() + .getWithResponse( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", + "VMNotWorkingInsight", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionListSamples.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionListSamples.java new file mode 100644 index 0000000000000..486a239123ccb --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionListSamples.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.selfhelp.generated; + +/** Samples for DiscoverySolution List. */ +public final class DiscoverySolutionListSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/ListDiscoverySolutionsForKeyVaultResource.json + */ + /** + * Sample code: List DiscoverySolutions for a KeyVault resource. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void listDiscoverySolutionsForAKeyVaultResource( + com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager + .discoverySolutions() + .list( + "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/OperationsListSamples.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..5417803fe5799 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/samples/java/com/azure/resourcemanager/selfhelp/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.selfhelp.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/help/resource-manager/Microsoft.Help/preview/2023-01-01-preview/examples/ListOperations.json + */ + /** + * Sample code: List All Operations. + * + * @param manager Entry point to SelfHelpManager. + */ + public static void listAllOperations(com.azure.resourcemanager.selfhelp.SelfHelpManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityRequestTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityRequestTests.java new file mode 100644 index 0000000000000..e01b4ba56ab6b --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityRequestTests.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.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityRequest model = + BinaryData.fromString("{\"name\":\"a\",\"type\":\"th\"}").toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("a", model.name()); + Assertions.assertEquals("th", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailabilityRequest model = new CheckNameAvailabilityRequest().withName("a").withType("th"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("a", model.name()); + Assertions.assertEquals("th", model.type()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityResponseInnerTests.java new file mode 100644 index 0000000000000..146386ec2b462 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/CheckNameAvailabilityResponseInnerTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.CheckNameAvailabilityResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityResponseInner model = + BinaryData + .fromString("{\"nameAvailable\":false,\"reason\":\"bifpikxwczb\",\"message\":\"cnpqxuhivyqniwby\"}") + .toObject(CheckNameAvailabilityResponseInner.class); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals("bifpikxwczb", model.reason()); + Assertions.assertEquals("cnpqxuhivyqniwby", model.message()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailabilityResponseInner model = + new CheckNameAvailabilityResponseInner() + .withNameAvailable(false) + .withReason("bifpikxwczb") + .withMessage("cnpqxuhivyqniwby"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityResponseInner.class); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals("bifpikxwczb", model.reason()); + Assertions.assertEquals("cnpqxuhivyqniwby", model.message()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticInvocationTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticInvocationTests.java new file mode 100644 index 0000000000000..e2ab0ead07816 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticInvocationTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.models.DiagnosticInvocation; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiagnosticInvocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiagnosticInvocation model = + BinaryData + .fromString( + "{\"solutionId\":\"clxxwrljdo\",\"additionalParameters\":{\"xbnjbiksq\":\"cqvkocrcjdkwtn\",\"ainqpjwnzlljfm\":\"gls\",\"vmgxsab\":\"pee\"}}") + .toObject(DiagnosticInvocation.class); + Assertions.assertEquals("clxxwrljdo", model.solutionId()); + Assertions.assertEquals("cqvkocrcjdkwtn", model.additionalParameters().get("xbnjbiksq")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiagnosticInvocation model = + new DiagnosticInvocation() + .withSolutionId("clxxwrljdo") + .withAdditionalParameters( + mapOf("xbnjbiksq", "cqvkocrcjdkwtn", "ainqpjwnzlljfm", "gls", "vmgxsab", "pee")); + model = BinaryData.fromObject(model).toObject(DiagnosticInvocation.class); + Assertions.assertEquals("clxxwrljdo", model.solutionId()); + Assertions.assertEquals("cqvkocrcjdkwtn", model.additionalParameters().get("xbnjbiksq")); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticResourceInnerTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticResourceInnerTests.java new file mode 100644 index 0000000000000..29ea4f7f868c6 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticResourceInnerTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.DiagnosticResourceInner; +import com.azure.resourcemanager.selfhelp.models.DiagnosticInvocation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiagnosticResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiagnosticResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"globalParameters\":{\"mjgr\":\"vd\"},\"insights\":[{\"solutionId\":\"ukxgaud\",\"additionalParameters\":{}},{\"solutionId\":\"nhsjcnyej\",\"additionalParameters\":{}}],\"acceptedAt\":\"yhtnapczwlokjye\",\"provisioningState\":\"Failed\",\"diagnostics\":[{\"solutionId\":\"pjoxzjnch\",\"status\":\"MissingInputs\",\"insights\":[]}]},\"id\":\"dmailzydehojw\",\"name\":\"ahuxinpm\",\"type\":\"njaqwixjspro\"}") + .toObject(DiagnosticResourceInner.class); + Assertions.assertEquals("vd", model.globalParameters().get("mjgr")); + Assertions.assertEquals("ukxgaud", model.insights().get(0).solutionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiagnosticResourceInner model = + new DiagnosticResourceInner() + .withGlobalParameters(mapOf("mjgr", "vd")) + .withInsights( + Arrays + .asList( + new DiagnosticInvocation().withSolutionId("ukxgaud").withAdditionalParameters(mapOf()), + new DiagnosticInvocation().withSolutionId("nhsjcnyej").withAdditionalParameters(mapOf()))); + model = BinaryData.fromObject(model).toObject(DiagnosticResourceInner.class); + Assertions.assertEquals("vd", model.globalParameters().get("mjgr")); + Assertions.assertEquals("ukxgaud", model.insights().get(0).solutionId()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilityWithResponseMockTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilityWithResponseMockTests.java new file mode 100644 index 0000000000000..d4aa8c12580af --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsCheckNameAvailabilityWithResponseMockTests.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.selfhelp.SelfHelpManager; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.selfhelp.models.CheckNameAvailabilityResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DiagnosticsCheckNameAvailabilityWithResponseMockTests { + @Test + public void testCheckNameAvailabilityWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"nameAvailable\":false,\"reason\":\"hbzhfepg\",\"message\":\"qex\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SelfHelpManager manager = + SelfHelpManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + CheckNameAvailabilityResponse response = + manager + .diagnostics() + .checkNameAvailabilityWithResponse( + "oq", + new CheckNameAvailabilityRequest().withName("mkljavb").withType("dtqajzyulpkudj"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(false, response.nameAvailable()); + Assertions.assertEquals("hbzhfepg", response.reason()); + Assertions.assertEquals("qex", response.message()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetWithResponseMockTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..07343348ed122 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiagnosticsGetWithResponseMockTests.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.selfhelp.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.selfhelp.SelfHelpManager; +import com.azure.resourcemanager.selfhelp.models.DiagnosticResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DiagnosticsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"globalParameters\":{\"l\":\"rhhbcs\",\"bnbdxkqpxokajion\":\"mmajtjaodx\",\"jrmvdjwzrlo\":\"imexgstxgcpodgma\"},\"insights\":[],\"acceptedAt\":\"whijcoejctbza\",\"provisioningState\":\"Failed\",\"diagnostics\":[]},\"id\":\"bkbfkgukdkex\",\"name\":\"ppofmxaxcfjpgdd\",\"type\":\"ocjjxhvpmouexh\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SelfHelpManager manager = + SelfHelpManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DiagnosticResource response = + manager.diagnostics().getWithResponse("locx", "c", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("rhhbcs", response.globalParameters().get("l")); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoveryResponseTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoveryResponseTests.java new file mode 100644 index 0000000000000..e9c83c3d1144f --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoveryResponseTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import com.azure.resourcemanager.selfhelp.models.DiscoveryResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveryResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveryResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"solutionId\":\"plwckbas\",\"solutionType\":\"pnddhsgcbacphejk\",\"description\":\"ynqgoulzndlikwyq\",\"requiredParameterSets\":[]},\"id\":\"gibma\",\"name\":\"gakeqsr\",\"type\":\"yb\"},{\"properties\":{\"solutionId\":\"e\",\"solutionType\":\"ytb\",\"description\":\"qfou\",\"requiredParameterSets\":[]},\"id\":\"mnkzsmod\",\"name\":\"glougpbk\",\"type\":\"tmut\"},{\"properties\":{\"solutionId\":\"ktapspwgcuertu\",\"solutionType\":\"dosvqwhbmdgbbjf\",\"description\":\"gmbmbexppbh\",\"requiredParameterSets\":[]},\"id\":\"rolfpfp\",\"name\":\"algbquxigjyjg\",\"type\":\"jaoyfhrtx\"},{\"properties\":{\"solutionId\":\"erkujys\",\"solutionType\":\"eju\",\"description\":\"qawrlyxwj\",\"requiredParameterSets\":[]},\"id\":\"rbnwbxgjvtbvpy\",\"name\":\"szdnr\",\"type\":\"jq\"}],\"nextLink\":\"hmuouqfprwzwbn\"}") + .toObject(DiscoveryResponse.class); + Assertions.assertEquals("plwckbas", model.value().get(0).solutionId()); + Assertions.assertEquals("pnddhsgcbacphejk", model.value().get(0).solutionType()); + Assertions.assertEquals("ynqgoulzndlikwyq", model.value().get(0).description()); + Assertions.assertEquals("hmuouqfprwzwbn", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveryResponse model = + new DiscoveryResponse() + .withValue( + Arrays + .asList( + new SolutionMetadataResourceInner() + .withSolutionId("plwckbas") + .withSolutionType("pnddhsgcbacphejk") + .withDescription("ynqgoulzndlikwyq") + .withRequiredParameterSets(Arrays.asList()), + new SolutionMetadataResourceInner() + .withSolutionId("e") + .withSolutionType("ytb") + .withDescription("qfou") + .withRequiredParameterSets(Arrays.asList()), + new SolutionMetadataResourceInner() + .withSolutionId("ktapspwgcuertu") + .withSolutionType("dosvqwhbmdgbbjf") + .withDescription("gmbmbexppbh") + .withRequiredParameterSets(Arrays.asList()), + new SolutionMetadataResourceInner() + .withSolutionId("erkujys") + .withSolutionType("eju") + .withDescription("qawrlyxwj") + .withRequiredParameterSets(Arrays.asList()))) + .withNextLink("hmuouqfprwzwbn"); + model = BinaryData.fromObject(model).toObject(DiscoveryResponse.class); + Assertions.assertEquals("plwckbas", model.value().get(0).solutionId()); + Assertions.assertEquals("pnddhsgcbacphejk", model.value().get(0).solutionType()); + Assertions.assertEquals("ynqgoulzndlikwyq", model.value().get(0).description()); + Assertions.assertEquals("hmuouqfprwzwbn", model.nextLink()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionsListMockTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionsListMockTests.java new file mode 100644 index 0000000000000..f58399b3b36b4 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/DiscoverySolutionsListMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.selfhelp.SelfHelpManager; +import com.azure.resourcemanager.selfhelp.models.SolutionMetadataResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class DiscoverySolutionsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"solutionId\":\"hrhcffcyddglmjth\",\"solutionType\":\"kw\",\"description\":\"eicxmqciwqvhkhi\",\"requiredParameterSets\":[[\"dtopbob\",\"og\",\"m\"],[\"u\"],[\"a\"]]},\"id\":\"rzayv\",\"name\":\"t\",\"type\":\"gvdfgiotkftutq\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SelfHelpManager manager = + SelfHelpManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .discoverySolutions() + .list("zxibqeoj", "xqbzvddntwnd", "icbtwnpzao", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hrhcffcyddglmjth", response.iterator().next().solutionId()); + Assertions.assertEquals("kw", response.iterator().next().solutionType()); + Assertions.assertEquals("eicxmqciwqvhkhi", response.iterator().next().description()); + Assertions.assertEquals("dtopbob", response.iterator().next().requiredParameterSets().get(0).get(0)); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/InsightTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/InsightTests.java new file mode 100644 index 0000000000000..3ea702c44f4dc --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/InsightTests.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.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.models.ImportanceLevel; +import com.azure.resourcemanager.selfhelp.models.Insight; +import org.junit.jupiter.api.Assertions; + +public final class InsightTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Insight model = + BinaryData + .fromString( + "{\"id\":\"zwyiftyhxhur\",\"title\":\"ftyxolniw\",\"results\":\"cukjf\",\"importanceLevel\":\"Critical\"}") + .toObject(Insight.class); + Assertions.assertEquals("zwyiftyhxhur", model.id()); + Assertions.assertEquals("ftyxolniw", model.title()); + Assertions.assertEquals("cukjf", model.results()); + Assertions.assertEquals(ImportanceLevel.CRITICAL, model.importanceLevel()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Insight model = + new Insight() + .withId("zwyiftyhxhur") + .withTitle("ftyxolniw") + .withResults("cukjf") + .withImportanceLevel(ImportanceLevel.CRITICAL); + model = BinaryData.fromObject(model).toObject(Insight.class); + Assertions.assertEquals("zwyiftyhxhur", model.id()); + Assertions.assertEquals("ftyxolniw", model.title()); + Assertions.assertEquals("cukjf", model.results()); + Assertions.assertEquals(ImportanceLevel.CRITICAL, model.importanceLevel()); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationDisplayTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..3c15c36d11a5d --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationDisplayTests.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.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = + BinaryData + .fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationInnerTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..7bc0a542b6552 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.OperationInner; +import com.azure.resourcemanager.selfhelp.models.OperationDisplay; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = + BinaryData + .fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationListResultTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..f966aca87b3d2 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationListResultTests.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.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.models.OperationListResult; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = new OperationListResult(); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationsListMockTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..9d02fe7305380 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/OperationsListMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.selfhelp.SelfHelpManager; +import com.azure.resourcemanager.selfhelp.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"whdsoifiyip\",\"isDataAction\":false,\"display\":{\"provider\":\"pgrjbz\",\"resource\":\"rcjxvsnbyxqabn\",\"operation\":\"cpc\",\"description\":\"hurzafblj\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + SelfHelpManager manager = + SelfHelpManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataPropertiesTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataPropertiesTests.java new file mode 100644 index 0000000000000..f19ef3203feb5 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataPropertiesTests.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.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SolutionMetadataPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SolutionMetadataProperties model = + BinaryData + .fromString( + "{\"solutionId\":\"lnrosfqp\",\"solutionType\":\"ehzzvypyqrim\",\"description\":\"npvswjdkirso\",\"requiredParameterSets\":[[\"hc\"],[\"nohjt\"]]}") + .toObject(SolutionMetadataProperties.class); + Assertions.assertEquals("lnrosfqp", model.solutionId()); + Assertions.assertEquals("ehzzvypyqrim", model.solutionType()); + Assertions.assertEquals("npvswjdkirso", model.description()); + Assertions.assertEquals("hc", model.requiredParameterSets().get(0).get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SolutionMetadataProperties model = + new SolutionMetadataProperties() + .withSolutionId("lnrosfqp") + .withSolutionType("ehzzvypyqrim") + .withDescription("npvswjdkirso") + .withRequiredParameterSets(Arrays.asList(Arrays.asList("hc"), Arrays.asList("nohjt"))); + model = BinaryData.fromObject(model).toObject(SolutionMetadataProperties.class); + Assertions.assertEquals("lnrosfqp", model.solutionId()); + Assertions.assertEquals("ehzzvypyqrim", model.solutionType()); + Assertions.assertEquals("npvswjdkirso", model.description()); + Assertions.assertEquals("hc", model.requiredParameterSets().get(0).get(0)); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataResourceInnerTests.java b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataResourceInnerTests.java new file mode 100644 index 0000000000000..631d0925fc833 --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/java/com/azure/resourcemanager/selfhelp/generated/SolutionMetadataResourceInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.selfhelp.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.selfhelp.fluent.models.SolutionMetadataResourceInner; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SolutionMetadataResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SolutionMetadataResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"solutionId\":\"tnwu\",\"solutionType\":\"gazxuf\",\"description\":\"uckyf\",\"requiredParameterSets\":[[\"idf\",\"zwdzuh\"],[\"mwisdkfthwxmnt\",\"i\",\"aop\"],[\"mijcmmxdcufufs\"]]},\"id\":\"ymzidn\",\"name\":\"ezcxtbzsgfyccsne\",\"type\":\"mdwzjeiachboo\"}") + .toObject(SolutionMetadataResourceInner.class); + Assertions.assertEquals("tnwu", model.solutionId()); + Assertions.assertEquals("gazxuf", model.solutionType()); + Assertions.assertEquals("uckyf", model.description()); + Assertions.assertEquals("idf", model.requiredParameterSets().get(0).get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SolutionMetadataResourceInner model = + new SolutionMetadataResourceInner() + .withSolutionId("tnwu") + .withSolutionType("gazxuf") + .withDescription("uckyf") + .withRequiredParameterSets( + Arrays + .asList( + Arrays.asList("idf", "zwdzuh"), + Arrays.asList("mwisdkfthwxmnt", "i", "aop"), + Arrays.asList("mijcmmxdcufufs"))); + model = BinaryData.fromObject(model).toObject(SolutionMetadataResourceInner.class); + Assertions.assertEquals("tnwu", model.solutionId()); + Assertions.assertEquals("gazxuf", model.solutionType()); + Assertions.assertEquals("uckyf", model.description()); + Assertions.assertEquals("idf", model.requiredParameterSets().get(0).get(0)); + } +} diff --git a/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 0000000000000..1f0955d450f0d --- /dev/null +++ b/sdk/selfhelp/azure-resourcemanager-selfhelp/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline