From 8103c4c884719e033d2b1a801da1a70e8a686f76 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 15 Mar 2021 18:55:00 +0000 Subject: [PATCH] CodeGen from PR 13426 in Azure/azure-rest-api-specs Merge 99823898149031f15f0732e431ca42c04289ff05 into 47f35bfb2246e9cc196b1ea6fe44a5dcbfa7a090 --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 + .../pom.xml | 67 + .../communication/CommunicationManager.java | 238 ++ .../CommunicationServiceManagementClient.java | 67 + .../fluent/CommunicationServicesClient.java | 379 +++ .../fluent/OperationStatusesClient.java | 41 + .../fluent/OperationsClient.java | 36 + .../models/CommunicationServiceKeysInner.java | 130 + .../CommunicationServiceResourceInner.java | 184 ++ .../models/LinkedNotificationHubInner.java | 50 + .../fluent/models/NameAvailabilityInner.java | 102 + .../fluent/models/OperationInner.java | 125 + .../fluent/models/OperationStatusInner.java | 130 + .../fluent/models/package-info.java | 9 + .../communication/fluent/package-info.java | 9 + .../CommunicationServiceKeysImpl.java | 45 + ...icationServiceManagementClientBuilder.java | 146 ++ ...municationServiceManagementClientImpl.java | 321 +++ .../CommunicationServiceResourceImpl.java | 74 + .../CommunicationServicesClientImpl.java | 2308 +++++++++++++++++ .../CommunicationServicesImpl.java | 277 ++ .../LinkedNotificationHubImpl.java | 33 + .../implementation/NameAvailabilityImpl.java | 41 + .../implementation/OperationImpl.java | 51 + .../implementation/OperationStatusImpl.java | 55 + .../OperationStatusesClientImpl.java | 194 ++ .../implementation/OperationStatusesImpl.java | 60 + .../implementation/OperationsClientImpl.java | 269 ++ .../implementation/OperationsImpl.java | 46 + .../communication/implementation/Utils.java | 204 ++ .../implementation/package-info.java | 9 + .../communication/models/ActionType.java | 31 + .../models/CommunicationServiceKeys.java | 46 + .../models/CommunicationServiceResource.java | 83 + .../CommunicationServiceResourceList.java | 85 + .../models/CommunicationServices.java | 286 ++ ...nicationServicesCreateOrUpdateHeaders.java | 50 + ...icationServicesCreateOrUpdateResponse.java | 38 + .../CommunicationServicesDeleteHeaders.java | 50 + .../CommunicationServicesDeleteResponse.java | 30 + .../models/ErrorAdditionalInfo.java | 54 + .../communication/models/KeyType.java | 47 + .../models/LinkNotificationHubParameters.java | 88 + .../models/LinkedNotificationHub.java | 24 + .../models/LocationResource.java | 50 + .../models/NameAvailability.java | 38 + .../models/NameAvailabilityParameters.java | 88 + .../communication/models/Operation.java | 56 + .../models/OperationDisplay.java | 93 + .../models/OperationListResult.java | 62 + .../communication/models/OperationStatus.java | 61 + .../models/OperationStatuses.java | 36 + .../communication/models/Operations.java | 31 + .../communication/models/Origin.java | 37 + .../models/ProvisioningState.java | 55 + .../models/RegenerateKeyParameters.java | 51 + .../communication/models/Status.java | 46 + .../communication/models/TaggedResource.java | 52 + .../communication/models/package-info.java | 9 + .../communication/package-info.java | 8 + .../src/main/java/module-info.java | 19 + sdk/communication/ci.yml | 4 +- sdk/communication/pom.xml | 1 + 65 files changed, 7513 insertions(+), 1 deletion(-) create mode 100644 sdk/communication/azure-resourcemanager-communication/CHANGELOG.md create mode 100644 sdk/communication/azure-resourcemanager-communication/README.md create mode 100644 sdk/communication/azure-resourcemanager-communication/pom.xml create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServicesClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationsClient.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/NameAvailabilityInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/package-info.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/package-info.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceKeysImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/LinkedNotificationHubImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/NameAvailabilityImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsImpl.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/Utils.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/package-info.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceKeys.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateHeaders.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateResponse.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteHeaders.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteResponse.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ErrorAdditionalInfo.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LocationResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailability.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operation.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operations.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/package-info.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/package-info.java create mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index d12629276466..5ccba774353e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-communication;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md new file mode 100644 index 000000000000..c055c240a3ba --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-15) + +- Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2020-08-20. 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/communication/azure-resourcemanager-communication/README.md b/sdk/communication/azure-resourcemanager-communication/README.md new file mode 100644 index 000000000000..6e21d3d0f802 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Communication client library for Java + +Azure Resource Manager Communication client library for Java. + +This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2020-08-20. 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-communication;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-communication + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CommunicationManager manager = CommunicationManager + .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 + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/communication/azure-resourcemanager-communication/pom.xml b/sdk/communication/azure-resourcemanager-communication/pom.xml new file mode 100644 index 000000000000..aff1f201dd0c --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-communication + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Communication Management + This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2020-08-20. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java new file mode 100644 index 000000000000..2940b953a905 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.CommunicationServiceManagementClient; +import com.azure.resourcemanager.communication.implementation.CommunicationServiceManagementClientBuilder; +import com.azure.resourcemanager.communication.implementation.CommunicationServicesImpl; +import com.azure.resourcemanager.communication.implementation.OperationStatusesImpl; +import com.azure.resourcemanager.communication.implementation.OperationsImpl; +import com.azure.resourcemanager.communication.models.CommunicationServices; +import com.azure.resourcemanager.communication.models.OperationStatuses; +import com.azure.resourcemanager.communication.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to CommunicationManager. REST API for Azure Communication Services. */ +public final class CommunicationManager { + private Operations operations; + + private CommunicationServices communicationServices; + + private OperationStatuses operationStatuses; + + private final CommunicationServiceManagementClient clientObject; + + private CommunicationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new CommunicationServiceManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Communication service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Communication service API instance. + */ + public static CommunicationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create CommunicationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CommunicationManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Communication service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Communication service API instance. + */ + public CommunicationManager 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.communication") + .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 (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CommunicationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of CommunicationServices. */ + public CommunicationServices communicationServices() { + if (this.communicationServices == null) { + this.communicationServices = new CommunicationServicesImpl(clientObject.getCommunicationServices(), this); + } + return communicationServices; + } + + /** @return Resource collection API of OperationStatuses. */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); + } + return operationStatuses; + } + + /** + * @return Wrapped service client CommunicationServiceManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public CommunicationServiceManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java new file mode 100644 index 000000000000..d7f2dd2cc210 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for CommunicationServiceManagementClient class. */ +public interface CommunicationServiceManagementClient { + /** + * 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 CommunicationServicesClient object to access its operations. + * + * @return the CommunicationServicesClient object. + */ + CommunicationServicesClient getCommunicationServices(); + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + OperationStatusesClient getOperationStatuses(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServicesClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServicesClient.java new file mode 100644 index 000000000000..9f9d0cb8569c --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServicesClient.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.CommunicationServiceKeysInner; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; +import com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; +import com.azure.resourcemanager.communication.models.NameAvailabilityParameters; +import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; + +/** An instance of this class provides access to all the operations defined in CommunicationServicesClient. */ +public interface CommunicationServicesClient { + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner checkNameAvailability(); + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the operation. + * @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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + NameAvailabilityParameters nameAvailabilityParameters, Context context); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LinkedNotificationHubInner linkNotificationHub(String resourceGroupName, String communicationServiceName); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the operation. + * @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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response linkNotificationHubWithResponse( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters, + Context context); + + /** + * Handles requests to list all resources in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Handles requests to list all resources in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceResourceInner update(String resourceGroupName, String communicationServiceName); + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context); + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceResourceInner getByResourceGroup(String resourceGroupName, String communicationServiceName); + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationServiceName, Context context); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CommunicationServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CommunicationServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceResourceInner createOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceResourceInner createOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String communicationServiceName); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationServiceName, Context context); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName, Context context); + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceKeysInner listKeys(String resourceGroupName, String communicationServiceName); + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listKeysWithResponse( + String resourceGroupName, String communicationServiceName, Context context); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key 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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationServiceKeysInner regenerateKey( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeyWithResponse( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters, Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java new file mode 100644 index 000000000000..4ecd617ef8b4 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public interface OperationStatusesClient { + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusInner get(String location, String operationId); + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationsClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationsClient.java new file mode 100644 index 000000000000..2370947263d2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java new file mode 100644 index 000000000000..36b5d73ab7bb --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceKeysInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A class representing the access keys of a CommunicationService. */ +@Fluent +public final class CommunicationServiceKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServiceKeysInner.class); + + /* + * The primary access key. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /* + * The secondary access key. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /* + * CommunicationService connection string constructed via the primaryKey + */ + @JsonProperty(value = "primaryConnectionString") + private String primaryConnectionString; + + /* + * CommunicationService connection string constructed via the secondaryKey + */ + @JsonProperty(value = "secondaryConnectionString") + private String secondaryConnectionString; + + /** + * Get the primaryKey property: The primary access key. + * + * @return the primaryKey value. + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primaryKey property: The primary access key. + * + * @param primaryKey the primaryKey value to set. + * @return the CommunicationServiceKeysInner object itself. + */ + public CommunicationServiceKeysInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondaryKey property: The secondary access key. + * + * @return the secondaryKey value. + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondaryKey property: The secondary access key. + * + * @param secondaryKey the secondaryKey value to set. + * @return the CommunicationServiceKeysInner object itself. + */ + public CommunicationServiceKeysInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get the primaryConnectionString property: CommunicationService connection string constructed via the primaryKey. + * + * @return the primaryConnectionString value. + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Set the primaryConnectionString property: CommunicationService connection string constructed via the primaryKey. + * + * @param primaryConnectionString the primaryConnectionString value to set. + * @return the CommunicationServiceKeysInner object itself. + */ + public CommunicationServiceKeysInner withPrimaryConnectionString(String primaryConnectionString) { + this.primaryConnectionString = primaryConnectionString; + return this; + } + + /** + * Get the secondaryConnectionString property: CommunicationService connection string constructed via the + * secondaryKey. + * + * @return the secondaryConnectionString value. + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Set the secondaryConnectionString property: CommunicationService connection string constructed via the + * secondaryKey. + * + * @param secondaryConnectionString the secondaryConnectionString value to set. + * @return the CommunicationServiceKeysInner object itself. + */ + public CommunicationServiceKeysInner withSecondaryConnectionString(String secondaryConnectionString) { + this.secondaryConnectionString = secondaryConnectionString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java new file mode 100644 index 000000000000..9dce087006ba --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.models.LocationResource; +import com.azure.resourcemanager.communication.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A class representing a CommunicationService resource. */ +@JsonFlatten +@Fluent +public class CommunicationServiceResourceInner extends LocationResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServiceResourceInner.class); + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * FQDN of the CommunicationService instance. + */ + @JsonProperty(value = "properties.hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostname; + + /* + * The location where the communication service stores its data at rest. + */ + @JsonProperty(value = "properties.dataLocation") + private String dataLocation; + + /* + * Resource ID of an Azure Notification Hub linked to this resource. + */ + @JsonProperty(value = "properties.notificationHubId", access = JsonProperty.Access.WRITE_ONLY) + private String notificationHubId; + + /* + * Version of the CommunicationService resource. Probably you need the same + * or higher version of client SDKs. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The immutable resource Id of the communication service. + */ + @JsonProperty(value = "properties.immutableResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String immutableResourceId; + + /* + * Tags of the service which is a list of key value pairs that describe the + * resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the hostname property: FQDN of the CommunicationService instance. + * + * @return the hostname value. + */ + public String hostname() { + return this.hostname; + } + + /** + * Get the dataLocation property: The location where the communication service stores its data at rest. + * + * @return the dataLocation value. + */ + public String dataLocation() { + return this.dataLocation; + } + + /** + * Set the dataLocation property: The location where the communication service stores its data at rest. + * + * @param dataLocation the dataLocation value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withDataLocation(String dataLocation) { + this.dataLocation = dataLocation; + return this; + } + + /** + * Get the notificationHubId property: Resource ID of an Azure Notification Hub linked to this resource. + * + * @return the notificationHubId value. + */ + public String notificationHubId() { + return this.notificationHubId; + } + + /** + * Get the version property: Version of the CommunicationService resource. Probably you need the same or higher + * version of client SDKs. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the immutableResourceId property: The immutable resource Id of the communication service. + * + * @return the immutableResourceId value. + */ + public String immutableResourceId() { + return this.immutableResourceId; + } + + /** + * Get the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @param tags the tags value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** {@inheritDoc} */ + @Override + public CommunicationServiceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java new file mode 100644 index 000000000000..dd3476b6143e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/LinkedNotificationHubInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A notification hub that has been linked to the communication service. */ +@Fluent +public final class LinkedNotificationHubInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkedNotificationHubInner.class); + + /* + * The resource ID of the notification hub + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * Get the resourceId property: The resource ID of the notification hub. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource ID of the notification hub. + * + * @param resourceId the resourceId value to set. + * @return the LinkedNotificationHubInner object itself. + */ + public LinkedNotificationHubInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/NameAvailabilityInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/NameAvailabilityInner.java new file mode 100644 index 000000000000..2cfd79a896b7 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/NameAvailabilityInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of the request to check name availability. It contains a flag and possible reason of failure. */ +@Fluent +public final class NameAvailabilityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); + + /* + * Indicates whether the name is available or not. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason of the availability. Required if name is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * The message of the operation. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: Indicates whether the name is available or not. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates whether the name is available or not. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason of the availability. Required if name is not available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason of the availability. Required if name is not available. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: The message of the operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message of the operation. + * + * @param message the message value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java new file mode 100644 index 000000000000..bdaf3f4e3c85 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.models.ActionType; +import com.azure.resourcemanager.communication.models.OperationDisplay; +import com.azure.resourcemanager.communication.models.Origin; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of a REST API operation, returned from the Resource Provider Operations API. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * 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; + + /** + * 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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java new file mode 100644 index 000000000000..2f88d5d594be --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.models.Status; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The current status of an async operation. */ +@JsonFlatten +@Fluent +public class OperationStatusInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusInner.class); + + /* + * Fully qualified ID for the operation status. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /* + * The start time of the operation + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time of the operation + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Percent of the operation that is complete + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Float percentComplete; + + /* + * The error object. + */ + @JsonProperty(value = "error.error") + private ManagementError error; + + /** + * Get the id property: Fully qualified ID for the operation status. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the status property: Provisioning state of the resource. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + public Float percentComplete() { + return this.percentComplete; + } + + /** + * Get the error property: The error object. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: The error object. + * + * @param error the error value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/package-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/package-info.java new file mode 100644 index 000000000000..3a00090623f2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/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 CommunicationServiceManagementClient. REST API for Azure Communication + * Services. + */ +package com.azure.resourcemanager.communication.fluent.models; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/package-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/package-info.java new file mode 100644 index 000000000000..598aea805249 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/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 CommunicationServiceManagementClient. REST API for Azure Communication + * Services. + */ +package com.azure.resourcemanager.communication.fluent; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceKeysImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceKeysImpl.java new file mode 100644 index 000000000000..4af9aa57c3a9 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceKeysImpl.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.communication.implementation; + +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner; +import com.azure.resourcemanager.communication.models.CommunicationServiceKeys; + +public final class CommunicationServiceKeysImpl implements CommunicationServiceKeys { + private CommunicationServiceKeysInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + CommunicationServiceKeysImpl( + CommunicationServiceKeysInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String primaryKey() { + return this.innerModel().primaryKey(); + } + + public String secondaryKey() { + return this.innerModel().secondaryKey(); + } + + public String primaryConnectionString() { + return this.innerModel().primaryConnectionString(); + } + + public String secondaryConnectionString() { + return this.innerModel().secondaryConnectionString(); + } + + public CommunicationServiceKeysInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java new file mode 100644 index 000000000000..9922db8db100 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the CommunicationServiceManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {CommunicationServiceManagementClientImpl.class}) +public final class CommunicationServiceManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder 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 CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the CommunicationServiceManagementClientBuilder. + */ + public CommunicationServiceManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CommunicationServiceManagementClientImpl with the provided parameters. + * + * @return an instance of CommunicationServiceManagementClientImpl. + */ + public CommunicationServiceManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + CommunicationServiceManagementClientImpl client = + new CommunicationServiceManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java new file mode 100644 index 000000000000..4f22d861a9b0 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.communication.fluent.CommunicationServiceManagementClient; +import com.azure.resourcemanager.communication.fluent.CommunicationServicesClient; +import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; +import com.azure.resourcemanager.communication.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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the CommunicationServiceManagementClientImpl type. */ +@ServiceClient(builder = CommunicationServiceManagementClientBuilder.class) +public final class CommunicationServiceManagementClientImpl implements CommunicationServiceManagementClient { + private final ClientLogger logger = new ClientLogger(CommunicationServiceManagementClientImpl.class); + + /** 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 CommunicationServicesClient object to access its operations. */ + private final CommunicationServicesClient communicationServices; + + /** + * Gets the CommunicationServicesClient object to access its operations. + * + * @return the CommunicationServicesClient object. + */ + public CommunicationServicesClient getCommunicationServices() { + return this.communicationServices; + } + + /** The OperationStatusesClient object to access its operations. */ + private final OperationStatusesClient operationStatuses; + + /** + * Gets the OperationStatusesClient object to access its operations. + * + * @return the OperationStatusesClient object. + */ + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; + } + + /** + * Initializes an instance of CommunicationServiceManagementClient 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. + */ + CommunicationServiceManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-08-20"; + this.operations = new OperationsClientImpl(this); + this.communicationServices = new CommunicationServicesClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java new file mode 100644 index 000000000000..563579c20625 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class CommunicationServiceResourceImpl implements CommunicationServiceResource { + private CommunicationServiceResourceInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + CommunicationServiceResourceImpl( + CommunicationServiceResourceInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String hostname() { + return this.innerModel().hostname(); + } + + public String dataLocation() { + return this.innerModel().dataLocation(); + } + + public String notificationHubId() { + return this.innerModel().notificationHubId(); + } + + public String version() { + return this.innerModel().version(); + } + + public String immutableResourceId() { + return this.innerModel().immutableResourceId(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CommunicationServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java new file mode 100644 index 000000000000..efd9c1150b8c --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesClientImpl.java @@ -0,0 +1,2308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.communication.fluent.CommunicationServicesClient; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; +import com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.communication.models.CommunicationServiceResourceList; +import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; +import com.azure.resourcemanager.communication.models.NameAvailabilityParameters; +import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; +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 CommunicationServicesClient. */ +public final class CommunicationServicesClientImpl implements CommunicationServicesClient { + private final ClientLogger logger = new ClientLogger(CommunicationServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CommunicationServicesService service; + + /** The service client containing this operation class. */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of CommunicationServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunicationServicesClientImpl(CommunicationServiceManagementClientImpl client) { + this.service = + RestProxy + .create(CommunicationServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientCommunicationServices to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationService") + private interface CommunicationServicesService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NameAvailabilityParameters nameAvailabilityParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}/linkNotificationHub") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> linkNotificationHub( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") LinkNotificationHubParameters linkNotificationHubParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices") + @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.Communication" + + "/communicationServices") + @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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") CommunicationServiceResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}") + @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("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") CommunicationServiceResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}") + @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("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listKeys( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication" + + "/communicationServices/{communicationServiceName}/regenerateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKey( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationServiceName") String communicationServiceName, + @BodyParam("application/json") RegenerateKeyParameters parameters, + @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); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the 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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + NameAvailabilityParameters nameAvailabilityParameters) { + 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 (nameAvailabilityParameters != null) { + nameAvailabilityParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + nameAvailabilityParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the operation. + * @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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + NameAvailabilityParameters nameAvailabilityParameters, 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 (nameAvailabilityParameters != null) { + nameAvailabilityParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + nameAvailabilityParameters, + accept, + context); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the 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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + NameAvailabilityParameters nameAvailabilityParameters) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync() { + final NameAvailabilityParameters nameAvailabilityParameters = null; + return checkNameAvailabilityWithResponseAsync(nameAvailabilityParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner checkNameAvailability() { + final NameAvailabilityParameters nameAvailabilityParameters = null; + return checkNameAvailabilityAsync(nameAvailabilityParameters).block(); + } + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the operation. + * @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 result of the request to check name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + NameAvailabilityParameters nameAvailabilityParameters, Context context) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityParameters, context).block(); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the 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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> linkNotificationHubWithResponseAsync( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (linkNotificationHubParameters != null) { + linkNotificationHubParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .linkNotificationHub( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + linkNotificationHubParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the operation. + * @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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> linkNotificationHubWithResponseAsync( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters, + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (linkNotificationHubParameters != null) { + linkNotificationHubParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .linkNotificationHub( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + linkNotificationHubParameters, + accept, + context); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the 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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkNotificationHubAsync( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters) { + return linkNotificationHubWithResponseAsync( + resourceGroupName, communicationServiceName, linkNotificationHubParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono linkNotificationHubAsync( + String resourceGroupName, String communicationServiceName) { + final LinkNotificationHubParameters linkNotificationHubParameters = null; + return linkNotificationHubWithResponseAsync( + resourceGroupName, communicationServiceName, linkNotificationHubParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LinkedNotificationHubInner linkNotificationHub(String resourceGroupName, String communicationServiceName) { + final LinkNotificationHubParameters linkNotificationHubParameters = null; + return linkNotificationHubAsync(resourceGroupName, communicationServiceName, linkNotificationHubParameters) + .block(); + } + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the operation. + * @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 notification hub that has been linked to the communication service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response linkNotificationHubWithResponse( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters, + Context context) { + return linkNotificationHubWithResponseAsync( + resourceGroupName, communicationServiceName, linkNotificationHubParameters, context) + .block(); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @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)); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @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)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + return updateWithResponseAsync(resourceGroupName, communicationServiceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String communicationServiceName) { + final CommunicationServiceResourceInner parameters = null; + return updateWithResponseAsync(resourceGroupName, communicationServiceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceResourceInner update(String resourceGroupName, String communicationServiceName) { + final CommunicationServiceResourceInner parameters = null; + return updateAsync(resourceGroupName, communicationServiceName, parameters).block(); + } + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, communicationServiceName, parameters, context).block(); + } + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String communicationServiceName) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName 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, + communicationServiceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String communicationServiceName, 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName 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, + communicationServiceName, + accept, + context); + } + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String communicationServiceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communicationServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceResourceInner getByResourceGroup( + String resourceGroupName, String communicationServiceName) { + return getByResourceGroupAsync(resourceGroupName, communicationServiceName).block(); + } + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationServiceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communicationServiceName, context).block(); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CommunicationServiceResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CommunicationServiceResourceInner.class, + CommunicationServiceResourceInner.class, + Context.NONE); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CommunicationServiceResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, communicationServiceName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CommunicationServiceResourceInner.class, + CommunicationServiceResourceInner.class, + context); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CommunicationServiceResourceInner> + beginCreateOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).getSyncPoller(); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CommunicationServiceResourceInner> + beginCreateOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context) + .getSyncPoller(); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String communicationServiceName) { + final CommunicationServiceResourceInner parameters = null; + return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceResourceInner createOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + return createOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).block(); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceResourceInner createOrUpdate(String resourceGroupName, String communicationServiceName) { + final CommunicationServiceResourceInner parameters = null; + return createOrUpdateAsync(resourceGroupName, communicationServiceName, parameters).block(); + } + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceResourceInner createOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, communicationServiceName, parameters, context).block(); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationServiceName) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName 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, + communicationServiceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationServiceName, 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName 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, + communicationServiceName, + accept, + context); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationServiceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communicationServiceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationServiceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, communicationServiceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communicationServiceName) { + return beginDeleteAsync(resourceGroupName, communicationServiceName).getSyncPoller(); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, communicationServiceName, context).getSyncPoller(); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communicationServiceName) { + return beginDeleteAsync(resourceGroupName, communicationServiceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communicationServiceName, Context context) { + return beginDeleteAsync(resourceGroupName, communicationServiceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName) { + deleteAsync(resourceGroupName, communicationServiceName).block(); + } + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName, Context context) { + deleteAsync(resourceGroupName, communicationServiceName, context).block(); + } + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String communicationServiceName) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listKeysWithResponseAsync( + String resourceGroupName, String communicationServiceName, 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listKeys( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + accept, + context); + } + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listKeysAsync( + String resourceGroupName, String communicationServiceName) { + return listKeysWithResponseAsync(resourceGroupName, communicationServiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceKeysInner listKeys(String resourceGroupName, String communicationServiceName) { + return listKeysAsync(resourceGroupName, communicationServiceName).block(); + } + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listKeysWithResponse( + String resourceGroupName, String communicationServiceName, Context context) { + return listKeysWithResponseAsync(resourceGroupName, communicationServiceName, context).block(); + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key 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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters) { + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, + String communicationServiceName, + RegenerateKeyParameters parameters, + 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 (communicationServiceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter communicationServiceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationServiceName, + parameters, + accept, + context); + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key 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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters) { + return regenerateKeyWithResponseAsync(resourceGroupName, communicationServiceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key 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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationServiceKeysInner regenerateKey( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters) { + return regenerateKeyAsync(resourceGroupName, communicationServiceName, parameters).block(); + } + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeyWithResponse( + String resourceGroupName, + String communicationServiceName, + RegenerateKeyParameters parameters, + Context context) { + return regenerateKeyWithResponseAsync(resourceGroupName, communicationServiceName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @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 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + @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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java new file mode 100644 index 000000000000..e0e7e93a92a1 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.CommunicationServicesClient; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; +import com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.communication.models.CommunicationServiceKeys; +import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.CommunicationServices; +import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; +import com.azure.resourcemanager.communication.models.LinkedNotificationHub; +import com.azure.resourcemanager.communication.models.NameAvailability; +import com.azure.resourcemanager.communication.models.NameAvailabilityParameters; +import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CommunicationServicesImpl implements CommunicationServices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServicesImpl.class); + + private final CommunicationServicesClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public CommunicationServicesImpl( + CommunicationServicesClient innerClient, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public NameAvailability checkNameAvailability() { + NameAvailabilityInner inner = this.serviceClient().checkNameAvailability(); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + NameAvailabilityParameters nameAvailabilityParameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(nameAvailabilityParameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LinkedNotificationHub linkNotificationHub(String resourceGroupName, String communicationServiceName) { + LinkedNotificationHubInner inner = + this.serviceClient().linkNotificationHub(resourceGroupName, communicationServiceName); + if (inner != null) { + return new LinkedNotificationHubImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response linkNotificationHubWithResponse( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters, + Context context) { + Response inner = + this + .serviceClient() + .linkNotificationHubWithResponse( + resourceGroupName, communicationServiceName, linkNotificationHubParameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LinkedNotificationHubImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CommunicationServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CommunicationServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CommunicationServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CommunicationServiceResourceImpl(inner1, this.manager())); + } + + public CommunicationServiceResource update(String resourceGroupName, String communicationServiceName) { + CommunicationServiceResourceInner inner = + this.serviceClient().update(resourceGroupName, communicationServiceName); + if (inner != null) { + return new CommunicationServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, communicationServiceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunicationServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunicationServiceResource getByResourceGroup(String resourceGroupName, String communicationServiceName) { + CommunicationServiceResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, communicationServiceName); + if (inner != null) { + return new CommunicationServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationServiceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, communicationServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunicationServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunicationServiceResource createOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { + CommunicationServiceResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName, parameters); + if (inner != null) { + return new CommunicationServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public CommunicationServiceResource createOrUpdate(String resourceGroupName, String communicationServiceName) { + CommunicationServiceResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName); + if (inner != null) { + return new CommunicationServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public CommunicationServiceResource createOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context) { + CommunicationServiceResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName, parameters, context); + if (inner != null) { + return new CommunicationServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String communicationServiceName) { + this.serviceClient().delete(resourceGroupName, communicationServiceName); + } + + public void delete(String resourceGroupName, String communicationServiceName, Context context) { + this.serviceClient().delete(resourceGroupName, communicationServiceName, context); + } + + public CommunicationServiceKeys listKeys(String resourceGroupName, String communicationServiceName) { + CommunicationServiceKeysInner inner = + this.serviceClient().listKeys(resourceGroupName, communicationServiceName); + if (inner != null) { + return new CommunicationServiceKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listKeysWithResponse( + String resourceGroupName, String communicationServiceName, Context context) { + Response inner = + this.serviceClient().listKeysWithResponse(resourceGroupName, communicationServiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunicationServiceKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunicationServiceKeys regenerateKey( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters) { + CommunicationServiceKeysInner inner = + this.serviceClient().regenerateKey(resourceGroupName, communicationServiceName, parameters); + if (inner != null) { + return new CommunicationServiceKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeyWithResponse( + String resourceGroupName, + String communicationServiceName, + RegenerateKeyParameters parameters, + Context context) { + Response inner = + this + .serviceClient() + .regenerateKeyWithResponse(resourceGroupName, communicationServiceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunicationServiceKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CommunicationServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/LinkedNotificationHubImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/LinkedNotificationHubImpl.java new file mode 100644 index 000000000000..83f074b9ac9b --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/LinkedNotificationHubImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; +import com.azure.resourcemanager.communication.models.LinkedNotificationHub; + +public final class LinkedNotificationHubImpl implements LinkedNotificationHub { + private LinkedNotificationHubInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + LinkedNotificationHubImpl( + LinkedNotificationHubInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public LinkedNotificationHubInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/NameAvailabilityImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/NameAvailabilityImpl.java new file mode 100644 index 000000000000..57e9b6beb9f1 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/NameAvailabilityImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.communication.models.NameAvailability; + +public final class NameAvailabilityImpl implements NameAvailability { + private NameAvailabilityInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + NameAvailabilityImpl( + NameAvailabilityInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public NameAvailabilityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationImpl.java new file mode 100644 index 000000000000..986252f032b2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/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.communication.implementation; + +import com.azure.resourcemanager.communication.fluent.models.OperationInner; +import com.azure.resourcemanager.communication.models.ActionType; +import com.azure.resourcemanager.communication.models.Operation; +import com.azure.resourcemanager.communication.models.OperationDisplay; +import com.azure.resourcemanager.communication.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.communication.CommunicationManager 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.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java new file mode 100644 index 000000000000..607f8cc500ca --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.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.communication.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.communication.models.OperationStatus; +import com.azure.resourcemanager.communication.models.Status; +import java.time.OffsetDateTime; + +public final class OperationStatusImpl implements OperationStatus { + private OperationStatusInner innerObject; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + OperationStatusImpl( + OperationStatusInner innerObject, com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Status status() { + return this.innerModel().status(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Float percentComplete() { + return this.innerModel().percentComplete(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java new file mode 100644 index 000000000000..e0c666dc0984 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; +import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ +public final class OperationStatusesClientImpl implements OperationStatusesClient { + private final ClientLogger logger = new ClientLogger(OperationStatusesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationStatusesService service; + + /** The service client containing this operation class. */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of OperationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusesClientImpl(CommunicationServiceManagementClientImpl client) { + this.service = + RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientOperationStatuses to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationService") + private interface OperationStatusesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Communication/locations/{location}/operationStatuses/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("location") String location, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + location, + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String location, String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), this.client.getApiVersion(), location, operationId, accept, context); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String operationId) { + return getWithResponseAsync(location, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusInner get(String location, String operationId) { + return getAsync(location, operationId).block(); + } + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String operationId, Context context) { + return getWithResponseAsync(location, operationId, context).block(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java new file mode 100644 index 000000000000..1004978d4dff --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; +import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.communication.models.OperationStatus; +import com.azure.resourcemanager.communication.models.OperationStatuses; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationStatusesImpl implements OperationStatuses { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusesImpl.class); + + private final OperationStatusesClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public OperationStatusesImpl( + OperationStatusesClient innerClient, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationStatus get(String location, String operationId) { + OperationStatusInner inner = this.serviceClient().get(location, operationId); + if (inner != null) { + return new OperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String location, String operationId, Context context) { + Response inner = this.serviceClient().getWithResponse(location, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationStatusesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..62a13de8f4a1 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.OperationsClient; +import com.azure.resourcemanager.communication.fluent.models.OperationInner; +import com.azure.resourcemanager.communication.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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final CommunicationServiceManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CommunicationServiceManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommunicationServiceManagementClientOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CommunicationService") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Communication/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); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @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)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider. + */ + @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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsImpl.java new file mode 100644 index 000000000000..327f5d8f5a55 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.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.communication.fluent.OperationsClient; +import com.azure.resourcemanager.communication.fluent.models.OperationInner; +import com.azure.resourcemanager.communication.models.Operation; +import com.azure.resourcemanager.communication.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.communication.CommunicationManager 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.communication.CommunicationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/Utils.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/Utils.java new file mode 100644 index 000000000000..62bcc1c08885 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/package-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/package-info.java new file mode 100644 index 000000000000..cdbc39f4a039 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/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 CommunicationServiceManagementClient. REST API for Azure Communication + * Services. + */ +package com.azure.resourcemanager.communication.implementation; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java new file mode 100644 index 000000000000..2c6915ae5810 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ActionType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActionType. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * 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); + } + + /** @return known ActionType values. */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceKeys.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceKeys.java new file mode 100644 index 000000000000..3b40f43de832 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceKeys.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner; + +/** An immutable client-side representation of CommunicationServiceKeys. */ +public interface CommunicationServiceKeys { + /** + * Gets the primaryKey property: The primary access key. + * + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * Gets the secondaryKey property: The secondary access key. + * + * @return the secondaryKey value. + */ + String secondaryKey(); + + /** + * Gets the primaryConnectionString property: CommunicationService connection string constructed via the primaryKey. + * + * @return the primaryConnectionString value. + */ + String primaryConnectionString(); + + /** + * Gets the secondaryConnectionString property: CommunicationService connection string constructed via the + * secondaryKey. + * + * @return the secondaryConnectionString value. + */ + String secondaryConnectionString(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.CommunicationServiceKeysInner object. + * + * @return the inner object. + */ + CommunicationServiceKeysInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java new file mode 100644 index 000000000000..1419d211f207 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import java.util.Map; + +/** An immutable client-side representation of CommunicationServiceResource. */ +public interface CommunicationServiceResource { + /** + * Gets the location property: The Azure location where the CommunicationService is running. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the hostname property: FQDN of the CommunicationService instance. + * + * @return the hostname value. + */ + String hostname(); + + /** + * Gets the dataLocation property: The location where the communication service stores its data at rest. + * + * @return the dataLocation value. + */ + String dataLocation(); + + /** + * Gets the notificationHubId property: Resource ID of an Azure Notification Hub linked to this resource. + * + * @return the notificationHubId value. + */ + String notificationHubId(); + + /** + * Gets the version property: Version of the CommunicationService resource. Probably you need the same or higher + * version of client SDKs. + * + * @return the version value. + */ + String version(); + + /** + * Gets the immutableResourceId property: The immutable resource Id of the communication service. + * + * @return the immutableResourceId value. + */ + String immutableResourceId(); + + /** + * Gets the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner object. + * + * @return the inner object. + */ + CommunicationServiceResourceInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java new file mode 100644 index 000000000000..85431ffb432b --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResourceList.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Object that includes an array of CommunicationServices and a possible link for next set. */ +@Fluent +public final class CommunicationServiceResourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServiceResourceList.class); + + /* + * List of CommunicationService + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL the client should use to fetch the next page (per server side + * paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of CommunicationService. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of CommunicationService. + * + * @param value the value value to set. + * @return the CommunicationServiceResourceList object itself. + */ + public CommunicationServiceResourceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). It's + * null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). It's + * null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the CommunicationServiceResourceList object itself. + */ + public CommunicationServiceResourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java new file mode 100644 index 000000000000..6485f9cf5edd --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; + +/** Resource collection API of CommunicationServices. */ +public interface CommunicationServices { + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @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 result of the request to check name availability. + */ + NameAvailability checkNameAvailability(); + + /** + * Checks that the CommunicationService name is valid and is not already in use. + * + * @param nameAvailabilityParameters Parameters supplied to the operation. + * @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 result of the request to check name availability. + */ + Response checkNameAvailabilityWithResponse( + NameAvailabilityParameters nameAvailabilityParameters, Context context); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 notification hub that has been linked to the communication service. + */ + LinkedNotificationHub linkNotificationHub(String resourceGroupName, String communicationServiceName); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param linkNotificationHubParameters Parameters supplied to the operation. + * @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 notification hub that has been linked to the communication service. + */ + Response linkNotificationHubWithResponse( + String resourceGroupName, + String communicationServiceName, + LinkNotificationHubParameters linkNotificationHubParameters, + Context context); + + /** + * Handles requests to list all resources in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + PagedIterable list(); + + /** + * Handles requests to list all resources in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of CommunicationServices and a possible link for next set. + */ + PagedIterable list(Context context); + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Handles requests to list all resources in a 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 object that includes an array of CommunicationServices and a possible link for next set. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + CommunicationServiceResource update(String resourceGroupName, String communicationServiceName); + + /** + * Operation to update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the update operation. + * @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 class representing a CommunicationService resource. + */ + Response updateWithResponse( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context); + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + CommunicationServiceResource getByResourceGroup(String resourceGroupName, String communicationServiceName); + + /** + * Get the CommunicationService and its properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 CommunicationService and its properties. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationServiceName, Context context); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update 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 class representing a CommunicationService resource. + */ + CommunicationServiceResource createOrUpdate( + String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 class representing a CommunicationService resource. + */ + CommunicationServiceResource createOrUpdate(String resourceGroupName, String communicationServiceName); + + /** + * Create a new CommunicationService or update an existing CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameters for the create or update operation. + * @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 class representing a CommunicationService resource. + */ + CommunicationServiceResource createOrUpdate( + String resourceGroupName, + String communicationServiceName, + CommunicationServiceResourceInner parameters, + Context context); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName); + + /** + * Operation to delete a CommunicationService. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 communicationServiceName, Context context); + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + CommunicationServiceKeys listKeys(String resourceGroupName, String communicationServiceName); + + /** + * Get the access keys of the CommunicationService resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService 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 access keys of the CommunicationService resource. + */ + Response listKeysWithResponse( + String resourceGroupName, String communicationServiceName, Context context); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key 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 class representing the access keys of a CommunicationService. + */ + CommunicationServiceKeys regenerateKey( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. + */ + Response regenerateKeyWithResponse( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters, Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateHeaders.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateHeaders.java new file mode 100644 index 000000000000..b27e4272c718 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CommunicationServicesCreateOrUpdateHeaders model. */ +@Fluent +public final class CommunicationServicesCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServicesCreateOrUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the CommunicationServicesCreateOrUpdateHeaders object itself. + */ + public CommunicationServicesCreateOrUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateResponse.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateResponse.java new file mode 100644 index 000000000000..7fa524494dfa --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class CommunicationServicesCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of CommunicationServicesCreateOrUpdateResponse. + * + * @param request the request which resulted in this CommunicationServicesCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CommunicationServicesCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CommunicationServiceResourceInner value, + CommunicationServicesCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public CommunicationServiceResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteHeaders.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteHeaders.java new file mode 100644 index 000000000000..eaa2839032f2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CommunicationServicesDeleteHeaders model. */ +@Fluent +public final class CommunicationServicesDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServicesDeleteHeaders.class); + + /* + * The location property. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location property. + * + * @param location the location value to set. + * @return the CommunicationServicesDeleteHeaders object itself. + */ + public CommunicationServicesDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteResponse.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteResponse.java new file mode 100644 index 000000000000..a855a3c0f326 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServicesDeleteResponse.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class CommunicationServicesDeleteResponse extends ResponseBase { + /** + * Creates an instance of CommunicationServicesDeleteResponse. + * + * @param request the request which resulted in this CommunicationServicesDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CommunicationServicesDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + CommunicationServicesDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ErrorAdditionalInfo.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..5c36e395c3df --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ErrorAdditionalInfo.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java new file mode 100644 index 000000000000..b97e3320fb02 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/KeyType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for KeyType. */ +public enum KeyType { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"); + + /** The actual serialized value for a KeyType instance. */ + private final String value; + + KeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyType object, or null if unable to parse. + */ + @JsonCreator + public static KeyType fromString(String value) { + KeyType[] items = KeyType.values(); + for (KeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java new file mode 100644 index 000000000000..c4143e216338 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkNotificationHubParameters.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of an Azure Notification Hub to link to the communication service. */ +@Fluent +public final class LinkNotificationHubParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinkNotificationHubParameters.class); + + /* + * The resource ID of the notification hub + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /* + * Connection string for the notification hub + */ + @JsonProperty(value = "connectionString", required = true) + private String connectionString; + + /** + * Get the resourceId property: The resource ID of the notification hub. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource ID of the notification hub. + * + * @param resourceId the resourceId value to set. + * @return the LinkNotificationHubParameters object itself. + */ + public LinkNotificationHubParameters withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the connectionString property: Connection string for the notification hub. + * + * @return the connectionString value. + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Set the connectionString property: Connection string for the notification hub. + * + * @param connectionString the connectionString value to set. + * @return the LinkNotificationHubParameters object itself. + */ + public LinkNotificationHubParameters withConnectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceId in model LinkNotificationHubParameters")); + } + if (connectionString() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectionString in model LinkNotificationHubParameters")); + } + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.java new file mode 100644 index 000000000000..ba2f57197e1b --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.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.communication.models; + +import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner; + +/** An immutable client-side representation of LinkedNotificationHub. */ +public interface LinkedNotificationHub { + /** + * Gets the resourceId property: The resource ID of the notification hub. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner object. + * + * @return the inner object. + */ + LinkedNotificationHubInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LocationResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LocationResource.java new file mode 100644 index 000000000000..8c5dd3d6d73f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LocationResource.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An ARM resource with its own location (not a global or an inherited location). */ +@Fluent +public class LocationResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationResource.class); + + /* + * The Azure location where the CommunicationService is running. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The Azure location where the CommunicationService is running. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure location where the CommunicationService is running. + * + * @param location the location value to set. + * @return the LocationResource object itself. + */ + public LocationResource withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailability.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailability.java new file mode 100644 index 000000000000..1f151669680d --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailability.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner; + +/** An immutable client-side representation of NameAvailability. */ +public interface NameAvailability { + /** + * Gets the nameAvailable property: Indicates whether the name is available or not. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason of the availability. Required if name is not available. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the message property: The message of the operation. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.NameAvailabilityInner object. + * + * @return the inner object. + */ + NameAvailabilityInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java new file mode 100644 index 000000000000..53c25167769e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/NameAvailabilityParameters.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Data POST-ed to the nameAvailability action. */ +@Fluent +public final class NameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityParameters.class); + + /* + * The resource type. Should be always + * "Microsoft.Communication/CommunicationServices". + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * The CommunicationService name to validate. + * e.g."my-CommunicationService-name-here" + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the type property: The resource type. Should be always "Microsoft.Communication/CommunicationServices". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. Should be always "Microsoft.Communication/CommunicationServices". + * + * @param type the type value to set. + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The CommunicationService name to validate. e.g."my-CommunicationService-name-here". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The CommunicationService name to validate. e.g."my-CommunicationService-name-here". + * + * @param name the name value to set. + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model NameAvailabilityParameters")); + } + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model NameAvailabilityParameters")); + } + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operation.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operation.java new file mode 100644 index 000000000000..e8c74855db75 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.resourcemanager.communication.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.communication.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java new file mode 100644 index 000000000000..93b0a88c0447 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationDisplay.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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; + + /** + * 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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java new file mode 100644 index 000000000000..7e66a63edadb --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.communication.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * 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; + + /** + * 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/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java new file mode 100644 index 000000000000..907ad01b7b69 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the id property: Fully qualified ID for the operation status. + * + * @return the id value. + */ + String id(); + + /** + * Gets the status property: Provisioning state of the resource. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the startTime property: The start time of the operation. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time of the operation. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the percentComplete property: Percent of the operation that is complete. + * + * @return the percentComplete value. + */ + Float percentComplete(); + + /** + * Gets the error property: The error object. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.communication.fluent.models.OperationStatusInner object. + * + * @return the inner object. + */ + OperationStatusInner innerModel(); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java new file mode 100644 index 000000000000..18424972bb75 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationStatuses. */ +public interface OperationStatuses { + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async 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 current status of an async operation. + */ + OperationStatus get(String location, String operationId); + + /** + * Gets the current status of an async operation. + * + * @param location The Azure region. + * @param operationId The ID of an ongoing async operation. + * @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 current status of an async operation. + */ + Response getWithResponse(String location, String operationId, Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operations.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operations.java new file mode 100644 index 000000000000..09b91c2aaeb2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.Communication 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. + */ + PagedIterable list(Context context); +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java new file mode 100644 index 000000000000..6138c376320f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Origin.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Origin. */ +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 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); + } + + /** @return known Origin values. */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.java new file mode 100644 index 000000000000..6f646bff796f --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/ProvisioningState.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.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Unknown for ProvisioningState. */ + public static final ProvisioningState UNKNOWN = fromString("Unknown"); + + /** 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 Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** 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 Moving for ProvisioningState. */ + public static final ProvisioningState MOVING = fromString("Moving"); + + /** + * 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); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.java new file mode 100644 index 000000000000..206f2833d861 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/RegenerateKeyParameters.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.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters describes the request to regenerate access keys. */ +@Fluent +public final class RegenerateKeyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegenerateKeyParameters.class); + + /* + * The keyType to regenerate. Must be either 'primary' or + * 'secondary'(case-insensitive). + */ + @JsonProperty(value = "keyType") + private KeyType keyType; + + /** + * Get the keyType property: The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). + * + * @return the keyType value. + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Set the keyType property: The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). + * + * @param keyType the keyType value to set. + * @return the RegenerateKeyParameters object itself. + */ + public RegenerateKeyParameters withKeyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java new file mode 100644 index 000000000000..63b883bb7a99 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Status. */ +public final class Status extends ExpandableStringEnum { + /** Static value Succeeded for Status. */ + public static final Status SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for Status. */ + public static final Status FAILED = fromString("Failed"); + + /** Static value Canceled for Status. */ + public static final Status CANCELED = fromString("Canceled"); + + /** Static value Creating for Status. */ + public static final Status CREATING = fromString("Creating"); + + /** Static value Deleting for Status. */ + public static final Status DELETING = fromString("Deleting"); + + /** Static value Moving for Status. */ + public static final Status MOVING = fromString("Moving"); + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** @return known Status values. */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java new file mode 100644 index 000000000000..33324c86b392 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.communication.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An ARM resource with that can accept tags. */ +@Fluent +public class TaggedResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TaggedResource.class); + + /* + * Tags of the service which is a list of key value pairs that describe the + * resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags of the service which is a list of key value pairs that describe the resource. + * + * @param tags the tags value to set. + * @return the TaggedResource object itself. + */ + public TaggedResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/package-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/package-info.java new file mode 100644 index 000000000000..8c0f8d776b9e --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/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 CommunicationServiceManagementClient. REST API for Azure Communication + * Services. + */ +package com.azure.resourcemanager.communication.models; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/package-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/package-info.java new file mode 100644 index 000000000000..7ca0c559ff1a --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/package-info.java @@ -0,0 +1,8 @@ +// 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 CommunicationServiceManagementClient. REST API for Azure Communication Services. + */ +package com.azure.resourcemanager.communication; diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java new file mode 100644 index 000000000000..95993c6f62a2 --- /dev/null +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.communication { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.communication; + exports com.azure.resourcemanager.communication.fluent; + exports com.azure.resourcemanager.communication.fluent.models; + exports com.azure.resourcemanager.communication.models; + + opens com.azure.resourcemanager.communication.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.communication.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/communication/ci.yml b/sdk/communication/ci.yml index 1022d7d022c1..53a8ffdc8949 100644 --- a/sdk/communication/ci.yml +++ b/sdk/communication/ci.yml @@ -43,4 +43,6 @@ extends: - name: azure-communication-phonenumbers groupId: com.azure safeName: azurecommunicationphonenumbers - + - name: azure-resourcemanager-communication + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercommunication diff --git a/sdk/communication/pom.xml b/sdk/communication/pom.xml index 73d15eb5069e..1cbea8ab15c2 100644 --- a/sdk/communication/pom.xml +++ b/sdk/communication/pom.xml @@ -88,6 +88,7 @@ azure-communication-identity azure-communication-phonenumbers azure-communication-sms + azure-resourcemanager-communication