From 6e0efbfdf4910ac5f14e235d37ca6f2eb0397b88 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 24 Nov 2023 01:29:39 +0000 Subject: [PATCH] CodeGen from PR 26687 in Azure/azure-rest-api-specs Merge 28cc407c07ebe4ba999ee8500a4051881e52a86e into ae577864ae37f5f0b793b6012c034e104043c2ae --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 107 ++ .../SAMPLE.md | 190 +++ .../pom.xml | 62 + .../CommunitytrainingManager.java | 278 ++++ .../fluent/CommunityTrainingsClient.java | 272 ++++ .../fluent/MicrosoftCommunity.java | 62 + .../fluent/OperationsClient.java | 40 + .../fluent/models/CommunityTrainingInner.java | 124 ++ .../fluent/models/OperationInner.java | 129 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../implementation/CommunityTrainingImpl.java | 192 +++ .../CommunityTrainingsClientImpl.java | 1302 +++++++++++++++++ .../CommunityTrainingsImpl.java | 148 ++ .../MicrosoftCommunityBuilder.java | 136 ++ .../MicrosoftCommunityImpl.java | 303 ++++ .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 239 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/Utils.java | 197 +++ .../implementation/package-info.java | 9 + .../communitytraining/models/ActionType.java | 48 + .../models/CommunityTraining.java | 299 ++++ .../models/CommunityTrainingListResult.java | 91 ++ .../models/CommunityTrainingProperties.java | 257 ++++ .../models/CommunityTrainingUpdate.java | 115 ++ .../CommunityTrainingUpdateProperties.java | 58 + .../models/CommunityTrainings.java | 158 ++ .../IdentityConfigurationProperties.java | 296 ++++ ...IdentityConfigurationPropertiesUpdate.java | 273 ++++ .../communitytraining/models/Operation.java | 58 + .../models/OperationDisplay.java | 95 ++ .../models/OperationListResult.java | 64 + .../communitytraining/models/Operations.java | 35 + .../communitytraining/models/Origin.java | 59 + .../models/ProvisioningState.java | 78 + .../communitytraining/models/Sku.java | 176 +++ .../communitytraining/models/SkuTier.java | 72 + .../models/package-info.java | 9 + .../communitytraining/package-info.java | 9 + .../src/main/java/module-info.java | 15 + .../proxy-config.json | 1 + .../reflect-config.json | 76 + .../CommunityTrainingsCreateSamples.java | 42 + .../CommunityTrainingsDeleteSamples.java | 25 + ...ityTrainingsGetByResourceGroupSamples.java | 26 + ...tyTrainingsListByResourceGroupSamples.java | 25 + .../CommunityTrainingsListSamples.java | 25 + .../CommunityTrainingsUpdateSamples.java | 55 + .../generated/OperationsListSamples.java | 24 + sdk/communitytraining/ci.yml | 47 + sdk/communitytraining/pom.xml | 15 + 55 files changed, 6537 insertions(+) create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/CHANGELOG.md create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/README.md create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/SAMPLE.md create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/CommunitytrainingManager.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/CommunityTrainingsClient.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/MicrosoftCommunity.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/OperationsClient.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/CommunityTrainingInner.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/OperationInner.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/package-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/package-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsClientImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityBuilder.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsClientImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsImpl.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/Utils.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/package-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ActionType.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTraining.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingListResult.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingProperties.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdate.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdateProperties.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainings.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationProperties.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationPropertiesUpdate.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operation.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationDisplay.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationListResult.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operations.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Origin.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ProvisioningState.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Sku.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/SkuTier.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/package-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/package-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/module-info.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/proxy-config.json create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/reflect-config.json create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsCreateSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsDeleteSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsGetByResourceGroupSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListByResourceGroupSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsUpdateSamples.java create mode 100644 sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/OperationsListSamples.java create mode 100644 sdk/communitytraining/ci.yml create mode 100644 sdk/communitytraining/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0374d99aa7fa..504e3ab7b53d 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -437,6 +437,7 @@ com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesdatareplication;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-communitytraining;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;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index 48806d3b8a00..65c5e3a2a0dd 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ sdk/cognitiveservices sdk/commerce sdk/communication + sdk/communitytraining sdk/confidentialledger sdk/confluent sdk/connectedvmware diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/CHANGELOG.md b/sdk/communitytraining/azure-resourcemanager-communitytraining/CHANGELOG.md new file mode 100644 index 000000000000..8a930ad862ef --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-11-24) + +- Azure Resource Manager communitytraining client library for Java. This package contains Microsoft Azure SDK for communitytraining Management SDK. Package tag package-2023-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/README.md b/sdk/communitytraining/azure-resourcemanager-communitytraining/README.md new file mode 100644 index 000000000000..ef982f870ed3 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager communitytraining client library for Java + +Azure Resource Manager communitytraining client library for Java. + +This package contains Microsoft Azure SDK for communitytraining Management SDK. Package tag package-2023-11-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-communitytraining;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-communitytraining + 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, Microsoft Entra ID 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(); +CommunitytrainingManager manager = CommunitytrainingManager + .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/communitytraining/azure-resourcemanager-communitytraining/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://learn.microsoft.com/azure/developer/java/fundamentals/ +[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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcommunitytraining%2Fazure-resourcemanager-communitytraining%2FREADME.png) diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/SAMPLE.md b/sdk/communitytraining/azure-resourcemanager-communitytraining/SAMPLE.md new file mode 100644 index 000000000000..b56341851e60 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/SAMPLE.md @@ -0,0 +1,190 @@ +# Code snippets and samples + + +## CommunityTrainings + +- [Create](#communitytrainings_create) +- [Delete](#communitytrainings_delete) +- [GetByResourceGroup](#communitytrainings_getbyresourcegroup) +- [List](#communitytrainings_list) +- [ListByResourceGroup](#communitytrainings_listbyresourcegroup) +- [Update](#communitytrainings_update) + +## Operations + +- [List](#operations_list) +### CommunityTrainings_Create + +```java +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingProperties; +import com.azure.resourcemanager.communitytraining.models.IdentityConfigurationProperties; +import com.azure.resourcemanager.communitytraining.models.Sku; +import com.azure.resourcemanager.communitytraining.models.SkuTier; +import java.util.stream.Collectors; + +/** + * Samples for CommunityTrainings Create. + */ +public final class CommunityTrainingsCreateSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Create.json + */ + /** + * Sample code: CreateCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void createCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().define("ctApplication").withRegion("southeastasia").withExistingResourceGroup("rgCommunityTaining").withProperties(new CommunityTrainingProperties().withPortalName("ctwebsite").withPortalAdminEmailAddress("ctadmin@ct.com").withPortalOwnerOrganizationName("CT Portal Owner Organization").withPortalOwnerEmailAddress("ctcontact@ct.com").withIdentityConfiguration(new IdentityConfigurationProperties().withIdentityType("ADB2C").withTeamsEnabled(false).withTenantId("c1ffbb60-88cf-4b83-b54f-c47ae6220c19").withDomainName("cttenant").withClientId("8c92390f-2f30-493d-bd13-d3c3eba3709d").withClientSecret("fakeTokenPlaceholder").withB2CAuthenticationPolicy("B2C_1_signup_signin").withB2CPasswordResetPolicy("fakeTokenPlaceholder").withCustomLoginParameters("custom_hint")).withZoneRedundancyEnabled(true).withDisasterRecoveryEnabled(true)).withSku(new Sku().withName("Commercial").withTier(SkuTier.STANDARD)).create(); + } +} +``` + +### CommunityTrainings_Delete + +```java +/** + * Samples for CommunityTrainings Delete. + */ +public final class CommunityTrainingsDeleteSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Delete.json + */ + /** + * Sample code: DeleteCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void deleteCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().delete("rgCommunityTraining", "ctApplication", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityTrainings_GetByResourceGroup + +```java +/** + * Samples for CommunityTrainings GetByResourceGroup. + */ +public final class CommunityTrainingsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Get.json + */ + /** + * Sample code: GetCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void getCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().getByResourceGroupWithResponse("rgCommunityTraining", "ctApplication", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityTrainings_List + +```java +/** + * Samples for CommunityTrainings List. + */ +public final class CommunityTrainingsListSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_ListBySubscription.json + */ + /** + * Sample code: ListBySubscriptionCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listBySubscriptionCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityTrainings_ListByResourceGroup + +```java +/** + * Samples for CommunityTrainings ListByResourceGroup. + */ +public final class CommunityTrainingsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_ListByResourceGroup.json + */ + /** + * Sample code: ListByResourceGroupCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listByResourceGroupCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().listByResourceGroup("rgCommunityTraining", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityTrainings_Update + +```java +import com.azure.resourcemanager.communitytraining.models.CommunityTraining; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdateProperties; +import com.azure.resourcemanager.communitytraining.models.IdentityConfigurationPropertiesUpdate; +import com.azure.resourcemanager.communitytraining.models.Sku; +import com.azure.resourcemanager.communitytraining.models.SkuTier; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Samples for CommunityTrainings Update. + */ +public final class CommunityTrainingsUpdateSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/CommunityTrainings_Update.json + */ + /** + * Sample code: UpdateCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void updateCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + CommunityTraining resource = manager.communityTrainings().getByResourceGroupWithResponse("rgCommunityTraining", "ctApplication", com.azure.core.util.Context.NONE).getValue(); + resource.update().withTags(mapOf()).withSku(new Sku().withName("Commercial").withTier(SkuTier.STANDARD)).withProperties(new CommunityTrainingUpdateProperties().withIdentityConfiguration(new IdentityConfigurationPropertiesUpdate().withIdentityType("ADB2C").withTeamsEnabled(false).withTenantId("c1ffbb60-88cf-4b83-b54f-c47ae6220c19").withDomainName("cttenant").withClientId("8c92390f-2f30-493d-bd13-d3c3eba3709d").withClientSecret("fakeTokenPlaceholder").withB2CAuthenticationPolicy("B2C_1_signup_signin").withB2CPasswordResetPolicy("fakeTokenPlaceholder").withCustomLoginParameters("custom_hint"))).apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/Operations_List.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listOperations(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml b/sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml new file mode 100644 index 000000000000..77f6c5ba8ea8 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-communitytraining + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for communitytraining Management + This package contains Microsoft Azure SDK for communitytraining Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2023-11-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.45.0 + + + com.azure + azure-core-management + 1.11.8 + + + diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/CommunitytrainingManager.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/CommunitytrainingManager.java new file mode 100644 index 000000000000..9ad784a3e4e9 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/CommunitytrainingManager.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining; + +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.communitytraining.fluent.MicrosoftCommunity; +import com.azure.resourcemanager.communitytraining.implementation.CommunityTrainingsImpl; +import com.azure.resourcemanager.communitytraining.implementation.MicrosoftCommunityBuilder; +import com.azure.resourcemanager.communitytraining.implementation.OperationsImpl; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainings; +import com.azure.resourcemanager.communitytraining.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 CommunitytrainingManager. + */ +public final class CommunitytrainingManager { + private Operations operations; + + private CommunityTrainings communityTrainings; + + private final MicrosoftCommunity clientObject; + + private CommunitytrainingManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftCommunityBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval).buildClient(); + } + + /** + * Creates an instance of communitytraining service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the communitytraining service API instance. + */ + public static CommunitytrainingManager 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 communitytraining service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the communitytraining service API instance. + */ + public static CommunitytrainingManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CommunitytrainingManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CommunitytrainingManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CommunitytrainingManager.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 communitytraining service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the communitytraining service API instance. + */ + public CommunitytrainingManager 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.communitytraining") + .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 CommunitytrainingManager(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 CommunityTrainings. It manages CommunityTraining. + * + * @return Resource collection API of CommunityTrainings. + */ + public CommunityTrainings communityTrainings() { + if (this.communityTrainings == null) { + this.communityTrainings = new CommunityTrainingsImpl(clientObject.getCommunityTrainings(), this); + } + return communityTrainings; + } + + /** + * Gets wrapped service client MicrosoftCommunity providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftCommunity. + */ + public MicrosoftCommunity serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/CommunityTrainingsClient.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/CommunityTrainingsClient.java new file mode 100644 index 000000000000..f0693d561a92 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/CommunityTrainingsClient.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdate; + +/** + * An instance of this class provides access to all the operations defined in CommunityTrainingsClient. + */ +public interface CommunityTrainingsClient { + /** + * List CommunityTraining resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List CommunityTraining resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String communityTrainingName, Context context); + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @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 CommunityTraining. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityTrainingInner getByResourceGroup(String resourceGroupName, String communityTrainingName); + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityTrainingInner> beginCreate(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource); + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityTrainingInner> beginCreate(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource, Context context); + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityTrainingInner create(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource); + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityTrainingInner create(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource, Context context); + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityTrainingInner> beginUpdate(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties); + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityTrainingInner> beginUpdate(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties, Context context); + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityTrainingInner update(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties); + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityTrainingInner update(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties, Context context); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityTrainingName); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityTrainingName, + Context context); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityTrainingName); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityTrainingName, Context context); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/MicrosoftCommunity.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/MicrosoftCommunity.java new file mode 100644 index 000000000000..f7ac197a8493 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/MicrosoftCommunity.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.communitytraining.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftCommunity class. + */ +public interface MicrosoftCommunity { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CommunityTrainingsClient object to access its operations. + * + * @return the CommunityTrainingsClient object. + */ + CommunityTrainingsClient getCommunityTrainings(); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/OperationsClient.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/OperationsClient.java new file mode 100644 index 000000000000..16c864aeb815 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/OperationsClient.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.communitytraining.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.communitytraining.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.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(); + + /** + * List the operations for the provider. + * + * @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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/CommunityTrainingInner.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/CommunityTrainingInner.java new file mode 100644 index 000000000000..766049fe059f --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/CommunityTrainingInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingProperties; +import com.azure.resourcemanager.communitytraining.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * A CommunityProviderHub resource. + */ +@Fluent +public final class CommunityTrainingInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private CommunityTrainingProperties properties; + + /* + * The SKU (Stock Keeping Unit) assigned to this resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Creates an instance of CommunityTrainingInner class. + */ + public CommunityTrainingInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CommunityTrainingProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CommunityTrainingInner object itself. + */ + public CommunityTrainingInner withProperties(CommunityTrainingProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @param sku the sku value to set. + * @return the CommunityTrainingInner object itself. + */ + public CommunityTrainingInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityTrainingInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityTrainingInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/OperationInner.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/OperationInner.java new file mode 100644 index 000000000000..24af28591d82 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/OperationInner.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.communitytraining.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.communitytraining.models.ActionType; +import com.azure.resourcemanager.communitytraining.models.OperationDisplay; +import com.azure.resourcemanager.communitytraining.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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/package-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/package-info.java new file mode 100644 index 000000000000..9dc3281a157e --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftCommunity. + * null. + */ +package com.azure.resourcemanager.communitytraining.fluent.models; diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/package-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/package-info.java new file mode 100644 index 000000000000..17880d90ae6d --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftCommunity. + * null. + */ +package com.azure.resourcemanager.communitytraining.fluent; diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingImpl.java new file mode 100644 index 000000000000..21a32155d3f0 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import com.azure.resourcemanager.communitytraining.models.CommunityTraining; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingProperties; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdate; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdateProperties; +import com.azure.resourcemanager.communitytraining.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class CommunityTrainingImpl + implements CommunityTraining, CommunityTraining.Definition, CommunityTraining.Update { + private CommunityTrainingInner innerObject; + + private final com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CommunityTrainingProperties properties() { + return this.innerModel().properties(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CommunityTrainingInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityTrainingName; + + private CommunityTrainingUpdate updateProperties; + + public CommunityTrainingImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CommunityTraining create() { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings().create(resourceGroupName, + communityTrainingName, this.innerModel(), Context.NONE); + return this; + } + + public CommunityTraining create(Context context) { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings().create(resourceGroupName, + communityTrainingName, this.innerModel(), context); + return this; + } + + CommunityTrainingImpl(String name, + com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager) { + this.innerObject = new CommunityTrainingInner(); + this.serviceManager = serviceManager; + this.communityTrainingName = name; + } + + public CommunityTrainingImpl update() { + this.updateProperties = new CommunityTrainingUpdate(); + return this; + } + + public CommunityTraining apply() { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings().update(resourceGroupName, + communityTrainingName, updateProperties, Context.NONE); + return this; + } + + public CommunityTraining apply(Context context) { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings().update(resourceGroupName, + communityTrainingName, updateProperties, context); + return this; + } + + CommunityTrainingImpl(CommunityTrainingInner innerObject, + com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communityTrainingName = Utils.getValueFromIdByName(innerObject.id(), "communityTrainings"); + } + + public CommunityTraining refresh() { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings() + .getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, Context.NONE).getValue(); + return this; + } + + public CommunityTraining refresh(Context context) { + this.innerObject = serviceManager.serviceClient().getCommunityTrainings() + .getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, context).getValue(); + return this; + } + + public CommunityTrainingImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CommunityTrainingImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CommunityTrainingImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CommunityTrainingImpl withProperties(CommunityTrainingProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CommunityTrainingImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateProperties.withSku(sku); + return this; + } + } + + public CommunityTrainingImpl withProperties(CommunityTrainingUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsClientImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsClientImpl.java new file mode 100644 index 000000000000..94c9d7c4b606 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsClientImpl.java @@ -0,0 +1,1302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.communitytraining.fluent.CommunityTrainingsClient; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingListResult; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdate; +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 CommunityTrainingsClient. + */ +public final class CommunityTrainingsClientImpl implements CommunityTrainingsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CommunityTrainingsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftCommunityImpl client; + + /** + * Initializes an instance of CommunityTrainingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityTrainingsClientImpl(MicrosoftCommunityImpl client) { + this.service = RestProxy.create(CommunityTrainingsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftCommunityCommunityTrainings to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftCommunityCo") + public interface CommunityTrainingsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communityTrainingName") String communityTrainingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communityTrainingName") String communityTrainingName, + @BodyParam("application/json") CommunityTrainingInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communityTrainingName") String communityTrainingName, + @BodyParam("application/json") CommunityTrainingUpdate properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communityTrainingName") String communityTrainingName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List CommunityTraining resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, 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())); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String communityTrainingName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityTrainingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String communityTrainingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityTrainingName, accept, context); + } + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String communityTrainingName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communityTrainingName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String communityTrainingName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communityTrainingName, context).block(); + } + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityTrainingInner getByResourceGroup(String resourceGroupName, String communityTrainingName) { + return getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, Context.NONE).getValue(); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityTrainingName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 CommunityProviderHub resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityTrainingName, resource, accept, context); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityTrainingInner> + beginCreateAsync(String resourceGroupName, String communityTrainingName, CommunityTrainingInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, communityTrainingName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityTrainingInner.class, CommunityTrainingInner.class, + this.client.getContext()); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityTrainingInner> beginCreateAsync( + String resourceGroupName, String communityTrainingName, CommunityTrainingInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, communityTrainingName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityTrainingInner.class, CommunityTrainingInner.class, context); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityTrainingInner> beginCreate(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource) { + return this.beginCreateAsync(resourceGroupName, communityTrainingName, resource).getSyncPoller(); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityTrainingInner> beginCreate(String resourceGroupName, + String communityTrainingName, CommunityTrainingInner resource, Context context) { + return this.beginCreateAsync(resourceGroupName, communityTrainingName, resource, context).getSyncPoller(); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource) { + return beginCreateAsync(resourceGroupName, communityTrainingName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 CommunityProviderHub resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource, Context context) { + return beginCreateAsync(resourceGroupName, communityTrainingName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityTrainingInner create(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource) { + return createAsync(resourceGroupName, communityTrainingName, resource).block(); + } + + /** + * Create a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param resource Resource create parameters. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityTrainingInner create(String resourceGroupName, String communityTrainingName, + CommunityTrainingInner resource, Context context) { + return createAsync(resourceGroupName, communityTrainingName, resource, context).block(); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityTrainingName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 CommunityProviderHub resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityTrainingName, properties, accept, context); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityTrainingInner> + beginUpdateAsync(String resourceGroupName, String communityTrainingName, CommunityTrainingUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityTrainingName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityTrainingInner.class, CommunityTrainingInner.class, + this.client.getContext()); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityTrainingInner> beginUpdateAsync( + String resourceGroupName, String communityTrainingName, CommunityTrainingUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityTrainingName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityTrainingInner.class, CommunityTrainingInner.class, context); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityTrainingInner> beginUpdate(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, communityTrainingName, properties).getSyncPoller(); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 a CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityTrainingInner> beginUpdate(String resourceGroupName, + String communityTrainingName, CommunityTrainingUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, communityTrainingName, properties, context).getSyncPoller(); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties) { + return beginUpdateAsync(resourceGroupName, communityTrainingName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 CommunityProviderHub resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, communityTrainingName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityTrainingInner update(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties) { + return updateAsync(resourceGroupName, communityTrainingName, properties).block(); + } + + /** + * Update a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param properties The resource properties to be updated. + * @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 CommunityProviderHub resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityTrainingInner update(String resourceGroupName, String communityTrainingName, + CommunityTrainingUpdate properties, Context context) { + return updateAsync(resourceGroupName, communityTrainingName, properties, context).block(); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String communityTrainingName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityTrainingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String communityTrainingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityTrainingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityTrainingName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityTrainingName, accept, context); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String communityTrainingName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communityTrainingName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityTrainingName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, communityTrainingName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityTrainingName) { + return this.beginDeleteAsync(resourceGroupName, communityTrainingName).getSyncPoller(); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityTrainingName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, communityTrainingName, context).getSyncPoller(); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityTrainingName) { + return beginDeleteAsync(resourceGroupName, communityTrainingName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityTrainingName, Context context) { + return beginDeleteAsync(resourceGroupName, communityTrainingName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityTrainingName) { + deleteAsync(resourceGroupName, communityTrainingName).block(); + } + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityTrainingName, Context context) { + deleteAsync(resourceGroupName, communityTrainingName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + * + * The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsImpl.java new file mode 100644 index 000000000000..cc043534fc52 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/CommunityTrainingsImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communitytraining.fluent.CommunityTrainingsClient; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import com.azure.resourcemanager.communitytraining.models.CommunityTraining; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainings; + +public final class CommunityTrainingsImpl implements CommunityTrainings { + private static final ClientLogger LOGGER = new ClientLogger(CommunityTrainingsImpl.class); + + private final CommunityTrainingsClient innerClient; + + private final com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager; + + public CommunityTrainingsImpl(CommunityTrainingsClient innerClient, + com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CommunityTrainingImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CommunityTrainingImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CommunityTrainingImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CommunityTrainingImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String communityTrainingName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CommunityTrainingImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunityTraining getByResourceGroup(String resourceGroupName, String communityTrainingName) { + CommunityTrainingInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, communityTrainingName); + if (inner != null) { + return new CommunityTrainingImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String communityTrainingName) { + this.serviceClient().delete(resourceGroupName, communityTrainingName); + } + + public void delete(String resourceGroupName, String communityTrainingName, Context context) { + this.serviceClient().delete(resourceGroupName, communityTrainingName, context); + } + + public CommunityTraining getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityTrainingName = Utils.getValueFromIdByName(id, "communityTrainings"); + if (communityTrainingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityTrainings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityTrainingName = Utils.getValueFromIdByName(id, "communityTrainings"); + if (communityTrainingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityTrainings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communityTrainingName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityTrainingName = Utils.getValueFromIdByName(id, "communityTrainings"); + if (communityTrainingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityTrainings'.", id))); + } + this.delete(resourceGroupName, communityTrainingName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityTrainingName = Utils.getValueFromIdByName(id, "communityTrainings"); + if (communityTrainingName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityTrainings'.", id))); + } + this.delete(resourceGroupName, communityTrainingName, context); + } + + private CommunityTrainingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager() { + return this.serviceManager; + } + + public CommunityTrainingImpl define(String name) { + return new CommunityTrainingImpl(name, this.manager()); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityBuilder.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityBuilder.java new file mode 100644 index 000000000000..ee5cb380461b --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityBuilder.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.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 MicrosoftCommunityImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftCommunityImpl.class }) +public final class MicrosoftCommunityBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder 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 MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder 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 MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder 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 MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder 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 MicrosoftCommunityBuilder. + */ + public MicrosoftCommunityBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftCommunityImpl with the provided parameters. + * + * @return an instance of MicrosoftCommunityImpl. + */ + public MicrosoftCommunityImpl 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(); + MicrosoftCommunityImpl client = new MicrosoftCommunityImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityImpl.java new file mode 100644 index 000000000000..7fe1c9385e00 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/MicrosoftCommunityImpl.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.communitytraining.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.communitytraining.fluent.CommunityTrainingsClient; +import com.azure.resourcemanager.communitytraining.fluent.MicrosoftCommunity; +import com.azure.resourcemanager.communitytraining.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 MicrosoftCommunityImpl type. + */ +@ServiceClient(builder = MicrosoftCommunityBuilder.class) +public final class MicrosoftCommunityImpl implements MicrosoftCommunity { + /** + * The ID of the target subscription. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The 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 CommunityTrainingsClient object to access its operations. + */ + private final CommunityTrainingsClient communityTrainings; + + /** + * Gets the CommunityTrainingsClient object to access its operations. + * + * @return the CommunityTrainingsClient object. + */ + public CommunityTrainingsClient getCommunityTrainings() { + return this.communityTrainings; + } + + /** + * Initializes an instance of MicrosoftCommunity client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MicrosoftCommunityImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-11-01"; + this.operations = new OperationsClientImpl(this); + this.communityTrainings = new CommunityTrainingsClientImpl(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(MicrosoftCommunityImpl.class); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationImpl.java new file mode 100644 index 000000000000..d65105455b11 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.implementation; + +import com.azure.resourcemanager.communitytraining.fluent.models.OperationInner; +import com.azure.resourcemanager.communitytraining.models.ActionType; +import com.azure.resourcemanager.communitytraining.models.Operation; +import com.azure.resourcemanager.communitytraining.models.OperationDisplay; +import com.azure.resourcemanager.communitytraining.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.communitytraining.CommunitytrainingManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.communitytraining.CommunitytrainingManager 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.communitytraining.CommunitytrainingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsClientImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..3705aaa37ae3 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.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.communitytraining.fluent.OperationsClient; +import com.azure.resourcemanager.communitytraining.fluent.models.OperationInner; +import com.azure.resourcemanager.communitytraining.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 MicrosoftCommunityImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftCommunityImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftCommunityOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftCommunityOp") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Community/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws 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())); + } + + /** + * List the operations for the provider. + * + * @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)); + } + + /** + * List the operations for the provider. + * + * @throws 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)); + } + + /** + * List the operations for the provider. + * + * @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)); + } + + /** + * List the operations for the provider. + * + * @throws 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()); + } + + /** + * List the operations for the provider. + * + * @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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsImpl.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/OperationsImpl.java new file mode 100644 index 000000000000..48f75e24ea86 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/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.communitytraining.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.communitytraining.fluent.OperationsClient; +import com.azure.resourcemanager.communitytraining.fluent.models.OperationInner; +import com.azure.resourcemanager.communitytraining.models.Operation; +import com.azure.resourcemanager.communitytraining.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.communitytraining.CommunitytrainingManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.communitytraining.CommunitytrainingManager 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.communitytraining.CommunitytrainingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/Utils.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/Utils.java new file mode 100644 index 000000000000..c27d24ed5701 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/Utils.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.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 { + private 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/package-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/package-info.java new file mode 100644 index 000000000000..38840ead2bef --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftCommunity. + * null. + */ +package com.azure.resourcemanager.communitytraining.implementation; diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ActionType.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ActionType.java new file mode 100644 index 000000000000..c0c47604bbcc --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ActionType.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTraining.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTraining.java new file mode 100644 index 000000000000..d00cc6be8f6d --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTraining.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import java.util.Map; + +/** + * An immutable client-side representation of CommunityTraining. + */ +public interface CommunityTraining { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + CommunityTrainingProperties properties(); + + /** + * Gets the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner object. + * + * @return the inner object. + */ + CommunityTrainingInner innerModel(); + + /** + * The entirety of the CommunityTraining definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CommunityTraining definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CommunityTraining definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CommunityTraining definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the CommunityTraining definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CommunityTraining definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommunityTraining create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommunityTraining create(Context context); + } + + /** + * The stage of the CommunityTraining definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CommunityTraining definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(CommunityTrainingProperties properties); + } + + /** + * The stage of the CommunityTraining definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU (Stock Keeping Unit) assigned to this resource.. + * + * @param sku The SKU (Stock Keeping Unit) assigned to this resource. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + } + + /** + * Begins update for the CommunityTraining resource. + * + * @return the stage of resource update. + */ + CommunityTraining.Update update(); + + /** + * The template for CommunityTraining update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommunityTraining apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommunityTraining apply(Context context); + } + + /** + * The CommunityTraining update stages. + */ + interface UpdateStages { + /** + * The stage of the CommunityTraining update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the CommunityTraining update allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU (Stock Keeping Unit) assigned to this resource.. + * + * @param sku The SKU (Stock Keeping Unit) assigned to this resource. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the CommunityTraining update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The updatable properties of the CommunityTraining.. + * + * @param properties The updatable properties of the CommunityTraining. + * @return the next definition stage. + */ + Update withProperties(CommunityTrainingUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommunityTraining refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommunityTraining refresh(Context context); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingListResult.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingListResult.java new file mode 100644 index 000000000000..95bd2c58e807 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingListResult.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.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The response of a CommunityTraining list operation. + */ +@Fluent +public final class CommunityTrainingListResult { + /* + * The CommunityTraining items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Creates an instance of CommunityTrainingListResult class. + */ + public CommunityTrainingListResult() { + } + + /** + * Get the value property: The CommunityTraining items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CommunityTraining items on this page. + * + * @param value the value value to set. + * @return the CommunityTrainingListResult object itself. + */ + public CommunityTrainingListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CommunityTrainingListResult object itself. + */ + public CommunityTrainingListResult 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) { + throw LOGGER.logExceptionAsError( + new IllegalArgumentException("Missing required property value in model CommunityTrainingListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunityTrainingListResult.class); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingProperties.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingProperties.java new file mode 100644 index 000000000000..89e00081890c --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingProperties.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Community CommunityTraining. + */ +@Fluent +public final class CommunityTrainingProperties { + /* + * The portal name (website name) of the Community Training instance + */ + @JsonProperty(value = "portalName", required = true) + private String portalName; + + /* + * The email address of the portal admin + */ + @JsonProperty(value = "portalAdminEmailAddress", required = true) + private String portalAdminEmailAddress; + + /* + * The organization name of the portal owner + */ + @JsonProperty(value = "portalOwnerOrganizationName", required = true) + private String portalOwnerOrganizationName; + + /* + * The email address of the portal owner. Will be used as the primary contact + */ + @JsonProperty(value = "portalOwnerEmailAddress", required = true) + private String portalOwnerEmailAddress; + + /* + * The identity configuration of the Community Training resource + */ + @JsonProperty(value = "identityConfiguration", required = true) + private IdentityConfigurationProperties identityConfiguration; + + /* + * To indicate whether the Community Training instance has Zone Redundancy enabled + */ + @JsonProperty(value = "zoneRedundancyEnabled", required = true) + private boolean zoneRedundancyEnabled; + + /* + * To indicate whether the Community Training instance has Disaster Recovery enabled + */ + @JsonProperty(value = "disasterRecoveryEnabled", required = true) + private boolean disasterRecoveryEnabled; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Creates an instance of CommunityTrainingProperties class. + */ + public CommunityTrainingProperties() { + } + + /** + * Get the portalName property: The portal name (website name) of the Community Training instance. + * + * @return the portalName value. + */ + public String portalName() { + return this.portalName; + } + + /** + * Set the portalName property: The portal name (website name) of the Community Training instance. + * + * @param portalName the portalName value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withPortalName(String portalName) { + this.portalName = portalName; + return this; + } + + /** + * Get the portalAdminEmailAddress property: The email address of the portal admin. + * + * @return the portalAdminEmailAddress value. + */ + public String portalAdminEmailAddress() { + return this.portalAdminEmailAddress; + } + + /** + * Set the portalAdminEmailAddress property: The email address of the portal admin. + * + * @param portalAdminEmailAddress the portalAdminEmailAddress value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withPortalAdminEmailAddress(String portalAdminEmailAddress) { + this.portalAdminEmailAddress = portalAdminEmailAddress; + return this; + } + + /** + * Get the portalOwnerOrganizationName property: The organization name of the portal owner. + * + * @return the portalOwnerOrganizationName value. + */ + public String portalOwnerOrganizationName() { + return this.portalOwnerOrganizationName; + } + + /** + * Set the portalOwnerOrganizationName property: The organization name of the portal owner. + * + * @param portalOwnerOrganizationName the portalOwnerOrganizationName value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withPortalOwnerOrganizationName(String portalOwnerOrganizationName) { + this.portalOwnerOrganizationName = portalOwnerOrganizationName; + return this; + } + + /** + * Get the portalOwnerEmailAddress property: The email address of the portal owner. Will be used as the primary + * contact. + * + * @return the portalOwnerEmailAddress value. + */ + public String portalOwnerEmailAddress() { + return this.portalOwnerEmailAddress; + } + + /** + * Set the portalOwnerEmailAddress property: The email address of the portal owner. Will be used as the primary + * contact. + * + * @param portalOwnerEmailAddress the portalOwnerEmailAddress value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withPortalOwnerEmailAddress(String portalOwnerEmailAddress) { + this.portalOwnerEmailAddress = portalOwnerEmailAddress; + return this; + } + + /** + * Get the identityConfiguration property: The identity configuration of the Community Training resource. + * + * @return the identityConfiguration value. + */ + public IdentityConfigurationProperties identityConfiguration() { + return this.identityConfiguration; + } + + /** + * Set the identityConfiguration property: The identity configuration of the Community Training resource. + * + * @param identityConfiguration the identityConfiguration value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties + withIdentityConfiguration(IdentityConfigurationProperties identityConfiguration) { + this.identityConfiguration = identityConfiguration; + return this; + } + + /** + * Get the zoneRedundancyEnabled property: To indicate whether the Community Training instance has Zone Redundancy + * enabled. + * + * @return the zoneRedundancyEnabled value. + */ + public boolean zoneRedundancyEnabled() { + return this.zoneRedundancyEnabled; + } + + /** + * Set the zoneRedundancyEnabled property: To indicate whether the Community Training instance has Zone Redundancy + * enabled. + * + * @param zoneRedundancyEnabled the zoneRedundancyEnabled value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withZoneRedundancyEnabled(boolean zoneRedundancyEnabled) { + this.zoneRedundancyEnabled = zoneRedundancyEnabled; + return this; + } + + /** + * Get the disasterRecoveryEnabled property: To indicate whether the Community Training instance has Disaster + * Recovery enabled. + * + * @return the disasterRecoveryEnabled value. + */ + public boolean disasterRecoveryEnabled() { + return this.disasterRecoveryEnabled; + } + + /** + * Set the disasterRecoveryEnabled property: To indicate whether the Community Training instance has Disaster + * Recovery enabled. + * + * @param disasterRecoveryEnabled the disasterRecoveryEnabled value to set. + * @return the CommunityTrainingProperties object itself. + */ + public CommunityTrainingProperties withDisasterRecoveryEnabled(boolean disasterRecoveryEnabled) { + this.disasterRecoveryEnabled = disasterRecoveryEnabled; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (portalName() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property portalName in model CommunityTrainingProperties")); + } + if (portalAdminEmailAddress() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property portalAdminEmailAddress in model CommunityTrainingProperties")); + } + if (portalOwnerOrganizationName() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property portalOwnerOrganizationName in model CommunityTrainingProperties")); + } + if (portalOwnerEmailAddress() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property portalOwnerEmailAddress in model CommunityTrainingProperties")); + } + if (identityConfiguration() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property identityConfiguration in model CommunityTrainingProperties")); + } else { + identityConfiguration().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunityTrainingProperties.class); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdate.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdate.java new file mode 100644 index 000000000000..86fc199058f8 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdate.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The type used for update operations of the CommunityTraining. + */ +@Fluent +public final class CommunityTrainingUpdate { + /* + * The SKU (Stock Keeping Unit) assigned to this resource. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the CommunityTraining. + */ + @JsonProperty(value = "properties") + private CommunityTrainingUpdateProperties properties; + + /** + * Creates an instance of CommunityTrainingUpdate class. + */ + public CommunityTrainingUpdate() { + } + + /** + * Get the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @param sku the sku value to set. + * @return the CommunityTrainingUpdate object itself. + */ + public CommunityTrainingUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CommunityTrainingUpdate object itself. + */ + public CommunityTrainingUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The updatable properties of the CommunityTraining. + * + * @return the properties value. + */ + public CommunityTrainingUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The updatable properties of the CommunityTraining. + * + * @param properties the properties value to set. + * @return the CommunityTrainingUpdate object itself. + */ + public CommunityTrainingUpdate withProperties(CommunityTrainingUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdateProperties.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdateProperties.java new file mode 100644 index 000000000000..13431e206bea --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainingUpdateProperties.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The updatable properties of the CommunityTraining. + */ +@Fluent +public final class CommunityTrainingUpdateProperties { + /* + * The identity configuration of the Community Training resource + */ + @JsonProperty(value = "identityConfiguration") + private IdentityConfigurationPropertiesUpdate identityConfiguration; + + /** + * Creates an instance of CommunityTrainingUpdateProperties class. + */ + public CommunityTrainingUpdateProperties() { + } + + /** + * Get the identityConfiguration property: The identity configuration of the Community Training resource. + * + * @return the identityConfiguration value. + */ + public IdentityConfigurationPropertiesUpdate identityConfiguration() { + return this.identityConfiguration; + } + + /** + * Set the identityConfiguration property: The identity configuration of the Community Training resource. + * + * @param identityConfiguration the identityConfiguration value to set. + * @return the CommunityTrainingUpdateProperties object itself. + */ + public CommunityTrainingUpdateProperties + withIdentityConfiguration(IdentityConfigurationPropertiesUpdate identityConfiguration) { + this.identityConfiguration = identityConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identityConfiguration() != null) { + identityConfiguration().validate(); + } + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainings.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainings.java new file mode 100644 index 000000000000..4d7b3af69a43 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/CommunityTrainings.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CommunityTrainings. + */ +public interface CommunityTrainings { + /** + * List CommunityTraining resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List CommunityTraining resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunityTraining resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityTraining list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String communityTrainingName, + Context context); + + /** + * Get a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @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 CommunityTraining. + */ + CommunityTraining getByResourceGroup(String resourceGroupName, String communityTrainingName); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String communityTrainingName); + + /** + * Delete a CommunityTraining. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityTrainingName, Context context); + + /** + * Get a CommunityTraining. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response}. + */ + CommunityTraining getById(String id); + + /** + * Get a CommunityTraining. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityTraining along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CommunityTraining. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a CommunityTraining. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommunityTraining resource. + * + * @param name resource name. + * @return the first stage of the new CommunityTraining definition. + */ + CommunityTraining.DefinitionStages.Blank define(String name); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationProperties.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationProperties.java new file mode 100644 index 000000000000..65bba5b482ee --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationProperties.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Community CommunityTraining Identity Configuration. + */ +@Fluent +public final class IdentityConfigurationProperties { + /* + * The identity type of the Community Training Resource + */ + @JsonProperty(value = "identityType", required = true) + private String identityType; + + /* + * To indicate whether the Community Training Resource has Teams enabled + */ + @JsonProperty(value = "teamsEnabled") + private Boolean teamsEnabled; + + /* + * The tenantId of the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "tenantId", required = true) + private String tenantId; + + /* + * The domain name of the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "domainName", required = true) + private String domainName; + + /* + * The clientId of the application registered in the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /* + * The client secret of the application registered in the selected identity provider for the Community Training + * Resource + */ + @JsonProperty(value = "clientSecret") + private String clientSecret; + + /* + * The name of the authentication policy registered in ADB2C for the Community Training Resource + */ + @JsonProperty(value = "b2cAuthenticationPolicy") + private String b2CAuthenticationPolicy; + + /* + * The name of the password reset policy registered in ADB2C for the Community Training Resource + */ + @JsonProperty(value = "b2cPasswordResetPolicy") + private String b2CPasswordResetPolicy; + + /* + * The custom login parameters for the Community Training Resource + */ + @JsonProperty(value = "customLoginParameters") + private String customLoginParameters; + + /** + * Creates an instance of IdentityConfigurationProperties class. + */ + public IdentityConfigurationProperties() { + } + + /** + * Get the identityType property: The identity type of the Community Training Resource. + * + * @return the identityType value. + */ + public String identityType() { + return this.identityType; + } + + /** + * Set the identityType property: The identity type of the Community Training Resource. + * + * @param identityType the identityType value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withIdentityType(String identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get the teamsEnabled property: To indicate whether the Community Training Resource has Teams enabled. + * + * @return the teamsEnabled value. + */ + public Boolean teamsEnabled() { + return this.teamsEnabled; + } + + /** + * Set the teamsEnabled property: To indicate whether the Community Training Resource has Teams enabled. + * + * @param teamsEnabled the teamsEnabled value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withTeamsEnabled(Boolean teamsEnabled) { + this.teamsEnabled = teamsEnabled; + return this; + } + + /** + * Get the tenantId property: The tenantId of the selected identity provider for the Community Training Resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId of the selected identity provider for the Community Training Resource. + * + * @param tenantId the tenantId value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the domainName property: The domain name of the selected identity provider for the Community Training + * Resource. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: The domain name of the selected identity provider for the Community Training + * Resource. + * + * @param domainName the domainName value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the clientId property: The clientId of the application registered in the selected identity provider for the + * Community Training Resource. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The clientId of the application registered in the selected identity provider for the + * Community Training Resource. + * + * @param clientId the clientId value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the clientSecret property: The client secret of the application registered in the selected identity provider + * for the Community Training Resource. + * + * @return the clientSecret value. + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set the clientSecret property: The client secret of the application registered in the selected identity provider + * for the Community Training Resource. + * + * @param clientSecret the clientSecret value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the b2CAuthenticationPolicy property: The name of the authentication policy registered in ADB2C for the + * Community Training Resource. + * + * @return the b2CAuthenticationPolicy value. + */ + public String b2CAuthenticationPolicy() { + return this.b2CAuthenticationPolicy; + } + + /** + * Set the b2CAuthenticationPolicy property: The name of the authentication policy registered in ADB2C for the + * Community Training Resource. + * + * @param b2CAuthenticationPolicy the b2CAuthenticationPolicy value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withB2CAuthenticationPolicy(String b2CAuthenticationPolicy) { + this.b2CAuthenticationPolicy = b2CAuthenticationPolicy; + return this; + } + + /** + * Get the b2CPasswordResetPolicy property: The name of the password reset policy registered in ADB2C for the + * Community Training Resource. + * + * @return the b2CPasswordResetPolicy value. + */ + public String b2CPasswordResetPolicy() { + return this.b2CPasswordResetPolicy; + } + + /** + * Set the b2CPasswordResetPolicy property: The name of the password reset policy registered in ADB2C for the + * Community Training Resource. + * + * @param b2CPasswordResetPolicy the b2CPasswordResetPolicy value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withB2CPasswordResetPolicy(String b2CPasswordResetPolicy) { + this.b2CPasswordResetPolicy = b2CPasswordResetPolicy; + return this; + } + + /** + * Get the customLoginParameters property: The custom login parameters for the Community Training Resource. + * + * @return the customLoginParameters value. + */ + public String customLoginParameters() { + return this.customLoginParameters; + } + + /** + * Set the customLoginParameters property: The custom login parameters for the Community Training Resource. + * + * @param customLoginParameters the customLoginParameters value to set. + * @return the IdentityConfigurationProperties object itself. + */ + public IdentityConfigurationProperties withCustomLoginParameters(String customLoginParameters) { + this.customLoginParameters = customLoginParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identityType() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property identityType in model IdentityConfigurationProperties")); + } + if (tenantId() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property tenantId in model IdentityConfigurationProperties")); + } + if (domainName() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property domainName in model IdentityConfigurationProperties")); + } + if (clientId() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property clientId in model IdentityConfigurationProperties")); + } + if (clientSecret() == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Missing required property clientSecret in model IdentityConfigurationProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IdentityConfigurationProperties.class); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationPropertiesUpdate.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationPropertiesUpdate.java new file mode 100644 index 000000000000..bc50b7b42a6b --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/IdentityConfigurationPropertiesUpdate.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Community CommunityTraining Identity Configuration. + */ +@Fluent +public final class IdentityConfigurationPropertiesUpdate { + /* + * The identity type of the Community Training Resource + */ + @JsonProperty(value = "identityType") + private String identityType; + + /* + * To indicate whether the Community Training Resource has Teams enabled + */ + @JsonProperty(value = "teamsEnabled") + private Boolean teamsEnabled; + + /* + * The tenantId of the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The domain name of the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "domainName") + private String domainName; + + /* + * The clientId of the application registered in the selected identity provider for the Community Training Resource + */ + @JsonProperty(value = "clientId") + private String clientId; + + /* + * The client secret of the application registered in the selected identity provider for the Community Training + * Resource + */ + @JsonProperty(value = "clientSecret") + private String clientSecret; + + /* + * The name of the authentication policy registered in ADB2C for the Community Training Resource + */ + @JsonProperty(value = "b2cAuthenticationPolicy") + private String b2CAuthenticationPolicy; + + /* + * The name of the password reset policy registered in ADB2C for the Community Training Resource + */ + @JsonProperty(value = "b2cPasswordResetPolicy") + private String b2CPasswordResetPolicy; + + /* + * The custom login parameters for the Community Training Resource + */ + @JsonProperty(value = "customLoginParameters") + private String customLoginParameters; + + /** + * Creates an instance of IdentityConfigurationPropertiesUpdate class. + */ + public IdentityConfigurationPropertiesUpdate() { + } + + /** + * Get the identityType property: The identity type of the Community Training Resource. + * + * @return the identityType value. + */ + public String identityType() { + return this.identityType; + } + + /** + * Set the identityType property: The identity type of the Community Training Resource. + * + * @param identityType the identityType value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withIdentityType(String identityType) { + this.identityType = identityType; + return this; + } + + /** + * Get the teamsEnabled property: To indicate whether the Community Training Resource has Teams enabled. + * + * @return the teamsEnabled value. + */ + public Boolean teamsEnabled() { + return this.teamsEnabled; + } + + /** + * Set the teamsEnabled property: To indicate whether the Community Training Resource has Teams enabled. + * + * @param teamsEnabled the teamsEnabled value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withTeamsEnabled(Boolean teamsEnabled) { + this.teamsEnabled = teamsEnabled; + return this; + } + + /** + * Get the tenantId property: The tenantId of the selected identity provider for the Community Training Resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenantId of the selected identity provider for the Community Training Resource. + * + * @param tenantId the tenantId value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the domainName property: The domain name of the selected identity provider for the Community Training + * Resource. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Set the domainName property: The domain name of the selected identity provider for the Community Training + * Resource. + * + * @param domainName the domainName value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withDomainName(String domainName) { + this.domainName = domainName; + return this; + } + + /** + * Get the clientId property: The clientId of the application registered in the selected identity provider for the + * Community Training Resource. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The clientId of the application registered in the selected identity provider for the + * Community Training Resource. + * + * @param clientId the clientId value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the clientSecret property: The client secret of the application registered in the selected identity provider + * for the Community Training Resource. + * + * @return the clientSecret value. + */ + public String clientSecret() { + return this.clientSecret; + } + + /** + * Set the clientSecret property: The client secret of the application registered in the selected identity provider + * for the Community Training Resource. + * + * @param clientSecret the clientSecret value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Get the b2CAuthenticationPolicy property: The name of the authentication policy registered in ADB2C for the + * Community Training Resource. + * + * @return the b2CAuthenticationPolicy value. + */ + public String b2CAuthenticationPolicy() { + return this.b2CAuthenticationPolicy; + } + + /** + * Set the b2CAuthenticationPolicy property: The name of the authentication policy registered in ADB2C for the + * Community Training Resource. + * + * @param b2CAuthenticationPolicy the b2CAuthenticationPolicy value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withB2CAuthenticationPolicy(String b2CAuthenticationPolicy) { + this.b2CAuthenticationPolicy = b2CAuthenticationPolicy; + return this; + } + + /** + * Get the b2CPasswordResetPolicy property: The name of the password reset policy registered in ADB2C for the + * Community Training Resource. + * + * @return the b2CPasswordResetPolicy value. + */ + public String b2CPasswordResetPolicy() { + return this.b2CPasswordResetPolicy; + } + + /** + * Set the b2CPasswordResetPolicy property: The name of the password reset policy registered in ADB2C for the + * Community Training Resource. + * + * @param b2CPasswordResetPolicy the b2CPasswordResetPolicy value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withB2CPasswordResetPolicy(String b2CPasswordResetPolicy) { + this.b2CPasswordResetPolicy = b2CPasswordResetPolicy; + return this; + } + + /** + * Get the customLoginParameters property: The custom login parameters for the Community Training Resource. + * + * @return the customLoginParameters value. + */ + public String customLoginParameters() { + return this.customLoginParameters; + } + + /** + * Set the customLoginParameters property: The custom login parameters for the Community Training Resource. + * + * @param customLoginParameters the customLoginParameters value to set. + * @return the IdentityConfigurationPropertiesUpdate object itself. + */ + public IdentityConfigurationPropertiesUpdate withCustomLoginParameters(String customLoginParameters) { + this.customLoginParameters = customLoginParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operation.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operation.java new file mode 100644 index 000000000000..080041701b8d --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.resourcemanager.communitytraining.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.communitytraining.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationDisplay.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationDisplay.java new file mode 100644 index 000000000000..a85e2e7c77c1 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationDisplay.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.communitytraining.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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationListResult.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationListResult.java new file mode 100644 index 000000000000..810aecde52d6 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/OperationListResult.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.communitytraining.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.communitytraining.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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operations.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operations.java new file mode 100644 index 000000000000..be4ebeae8c01 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Operations.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.communitytraining.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.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(); + + /** + * List the operations for the provider. + * + * @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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Origin.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Origin.java new file mode 100644 index 000000000000..5e42ffe010c4 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Origin.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ProvisioningState.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ProvisioningState.java new file mode 100644 index 000000000000..5998addd66ba --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/ProvisioningState.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * 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/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Sku.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Sku.java new file mode 100644 index 000000000000..4f9fa2b1089d --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/Sku.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource model definition representing SKU. + */ +@Fluent +public final class Sku { + /* + * The name of the SKU. Ex - P3. It is typically a letter+number code + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * This field is required to be implemented by the Resource Provider if the service has more than one tier, but is + * not required on a PUT. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some other value, this would be the standalone + * code. + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible + * for the resource this may be omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + } + + /** + * Get the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can + * be captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can + * be captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/SkuTier.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/SkuTier.java new file mode 100644 index 000000000000..675dbd57f4ae --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/SkuTier.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not + * required on a PUT. + */ +public enum SkuTier { + /** + * Enum value Free. + */ + FREE("Free"), + + /** + * Enum value Basic. + */ + BASIC("Basic"), + + /** + * Enum value Standard. + */ + STANDARD("Standard"), + + /** + * Enum value Premium. + */ + PREMIUM("Premium"); + + /** + * The actual serialized value for a SkuTier instance. + */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + if (value == null) { + return null; + } + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/package-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/package-info.java new file mode 100644 index 000000000000..0545b6ae2acf --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/models/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftCommunity. + * null. + */ +package com.azure.resourcemanager.communitytraining.models; diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/package-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/package-info.java new file mode 100644 index 000000000000..d4d9878a6692 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/com/azure/resourcemanager/communitytraining/package-info.java @@ -0,0 +1,9 @@ +// 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 MicrosoftCommunity. + * null. + */ +package com.azure.resourcemanager.communitytraining; diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/module-info.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/module-info.java new file mode 100644 index 000000000000..d555d4399938 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.communitytraining { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.communitytraining; + exports com.azure.resourcemanager.communitytraining.fluent; + exports com.azure.resourcemanager.communitytraining.fluent.models; + exports com.azure.resourcemanager.communitytraining.models; + + opens com.azure.resourcemanager.communitytraining.fluent.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.communitytraining.models to com.azure.core, com.fasterxml.jackson.databind; +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/proxy-config.json b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/proxy-config.json new file mode 100644 index 000000000000..f3793396b9f3 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.communitytraining.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.communitytraining.implementation.CommunityTrainingsClientImpl$CommunityTrainingsService" ] ] \ No newline at end of file diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/reflect-config.json b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/reflect-config.json new file mode 100644 index 000000000000..4e7515147f98 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-communitytraining/reflect-config.json @@ -0,0 +1,76 @@ +[ { + "name" : "com.azure.resourcemanager.communitytraining.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.CommunityTrainingListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.fluent.models.CommunityTrainingInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.CommunityTrainingProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.IdentityConfigurationProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.Sku", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdateProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.IdentityConfigurationPropertiesUpdate", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.ProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.communitytraining.models.SkuTier", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsCreateSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsCreateSamples.java new file mode 100644 index 000000000000..b7c6830914fb --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsCreateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.generated; + +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingProperties; +import com.azure.resourcemanager.communitytraining.models.IdentityConfigurationProperties; +import com.azure.resourcemanager.communitytraining.models.Sku; +import com.azure.resourcemanager.communitytraining.models.SkuTier; + +/** + * Samples for CommunityTrainings Create. + */ +public final class CommunityTrainingsCreateSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_Create.json + */ + /** + * Sample code: CreateCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void + createCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().define("ctApplication").withRegion("southeastasia") + .withExistingResourceGroup("rgCommunityTaining") + .withProperties(new CommunityTrainingProperties().withPortalName("ctwebsite") + .withPortalAdminEmailAddress("ctadmin@ct.com") + .withPortalOwnerOrganizationName("CT Portal Owner Organization") + .withPortalOwnerEmailAddress("ctcontact@ct.com") + .withIdentityConfiguration(new IdentityConfigurationProperties().withIdentityType("ADB2C") + .withTeamsEnabled(false).withTenantId("c1ffbb60-88cf-4b83-b54f-c47ae6220c19") + .withDomainName("cttenant").withClientId("8c92390f-2f30-493d-bd13-d3c3eba3709d") + .withClientSecret("fakeTokenPlaceholder").withB2CAuthenticationPolicy("B2C_1_signup_signin") + .withB2CPasswordResetPolicy("fakeTokenPlaceholder").withCustomLoginParameters("custom_hint")) + .withZoneRedundancyEnabled(true).withDisasterRecoveryEnabled(true)) + .withSku(new Sku().withName("Commercial").withTier(SkuTier.STANDARD)).create(); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsDeleteSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsDeleteSamples.java new file mode 100644 index 000000000000..56f4af6dc6cb --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsDeleteSamples.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.communitytraining.generated; + +/** + * Samples for CommunityTrainings Delete. + */ +public final class CommunityTrainingsDeleteSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_Delete.json + */ + /** + * Sample code: DeleteCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void + deleteCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().delete("rgCommunityTraining", "ctApplication", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsGetByResourceGroupSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..be1a9ebd28ff --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsGetByResourceGroupSamples.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.communitytraining.generated; + +/** + * Samples for CommunityTrainings GetByResourceGroup. + */ +public final class CommunityTrainingsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_Get.json + */ + /** + * Sample code: GetCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void + getCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().getByResourceGroupWithResponse("rgCommunityTraining", "ctApplication", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListByResourceGroupSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListByResourceGroupSamples.java new file mode 100644 index 000000000000..6f4a5e6f617a --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListByResourceGroupSamples.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.communitytraining.generated; + +/** + * Samples for CommunityTrainings ListByResourceGroup. + */ +public final class CommunityTrainingsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_ListByResourceGroup.json + */ + /** + * Sample code: ListByResourceGroupCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listByResourceGroupCommunityTrainings( + com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().listByResourceGroup("rgCommunityTraining", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListSamples.java new file mode 100644 index 000000000000..452cebcee314 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsListSamples.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.communitytraining.generated; + +/** + * Samples for CommunityTrainings List. + */ +public final class CommunityTrainingsListSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_ListBySubscription.json + */ + /** + * Sample code: ListBySubscriptionCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listBySubscriptionCommunityTrainings( + com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.communityTrainings().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsUpdateSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsUpdateSamples.java new file mode 100644 index 000000000000..517d0b3d4400 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/CommunityTrainingsUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.generated; + +import com.azure.resourcemanager.communitytraining.models.CommunityTraining; +import com.azure.resourcemanager.communitytraining.models.CommunityTrainingUpdateProperties; +import com.azure.resourcemanager.communitytraining.models.IdentityConfigurationPropertiesUpdate; +import com.azure.resourcemanager.communitytraining.models.Sku; +import com.azure.resourcemanager.communitytraining.models.SkuTier; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityTrainings Update. + */ +public final class CommunityTrainingsUpdateSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/ + * CommunityTrainings_Update.json + */ + /** + * Sample code: UpdateCommunityTrainings. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void + updateCommunityTrainings(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + CommunityTraining resource = manager.communityTrainings() + .getByResourceGroupWithResponse("rgCommunityTraining", "ctApplication", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).withSku(new Sku().withName("Commercial").withTier(SkuTier.STANDARD)) + .withProperties(new CommunityTrainingUpdateProperties() + .withIdentityConfiguration(new IdentityConfigurationPropertiesUpdate().withIdentityType("ADB2C") + .withTeamsEnabled(false).withTenantId("c1ffbb60-88cf-4b83-b54f-c47ae6220c19") + .withDomainName("cttenant").withClientId("8c92390f-2f30-493d-bd13-d3c3eba3709d") + .withClientSecret("fakeTokenPlaceholder").withB2CAuthenticationPolicy("B2C_1_signup_signin") + .withB2CPasswordResetPolicy("fakeTokenPlaceholder").withCustomLoginParameters("custom_hint"))) + .apply(); + } + + // Use "Map.of" if available + @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/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/OperationsListSamples.java b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/OperationsListSamples.java new file mode 100644 index 000000000000..ed606af35042 --- /dev/null +++ b/sdk/communitytraining/azure-resourcemanager-communitytraining/src/samples/java/com/azure/resourcemanager/communitytraining/generated/OperationsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communitytraining.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/communitytraining/resource-manager/Microsoft.Community/stable/2023-11-01/examples/Operations_List. + * json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to CommunitytrainingManager. + */ + public static void listOperations(com.azure.resourcemanager.communitytraining.CommunitytrainingManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/communitytraining/ci.yml b/sdk/communitytraining/ci.yml new file mode 100644 index 000000000000..b0e5820ffd9b --- /dev/null +++ b/sdk/communitytraining/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/communitytraining/ci.yml + - sdk/communitytraining/azure-resourcemanager-communitytraining/ + exclude: + - sdk/communitytraining/pom.xml + - sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communitytraining/ci.yml + - sdk/communitytraining/azure-resourcemanager-communitytraining/ + exclude: + - sdk/communitytraining/pom.xml + - sdk/communitytraining/azure-resourcemanager-communitytraining/pom.xml + +parameters: + - name: release_azureresourcemanagercommunitytraining + displayName: azure-resourcemanager-communitytraining + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: communitytraining + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-communitytraining + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercommunitytraining + releaseInBatch: ${{ parameters.release_azureresourcemanagercommunitytraining }} diff --git a/sdk/communitytraining/pom.xml b/sdk/communitytraining/pom.xml new file mode 100644 index 000000000000..dad0e7b4a0cc --- /dev/null +++ b/sdk/communitytraining/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-communitytraining-service + pom + 1.0.0 + + + azure-resourcemanager-communitytraining + +