diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0f9c517c59a21..cfabf7c5a3fa0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -396,6 +396,7 @@ com.azure.resourcemanager:azure-resourcemanager-providerhub;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index d3b512dfab72c..2c7336bffde95 100644 --- a/pom.xml +++ b/pom.xml @@ -179,6 +179,7 @@ sdk/translation sdk/videoanalyzer sdk/vmwarecloudsimple + sdk/voiceservices sdk/webpubsub sdk/workloads diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md new file mode 100644 index 0000000000000..4e566e46c9c45 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-02-20) + +- Azure Resource Manager voiceservices client library for Java. This package contains Microsoft Azure SDK for voiceservices Management SDK. Package tag package-2023-01-31. 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/voiceservices/azure-resourcemanager-voiceservices/README.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md new file mode 100644 index 0000000000000..69519c59dfb1a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager voiceservices client library for Java + +Azure Resource Manager voiceservices client library for Java. + +This package contains Microsoft Azure SDK for voiceservices Management SDK. Package tag package-2023-01-31. 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-voiceservices;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-voiceservices + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +VoiceservicesManager manager = VoiceservicesManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md b/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md new file mode 100644 index 0000000000000..a223257ea2477 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/SAMPLE.md @@ -0,0 +1,352 @@ +# Code snippets and samples + + +## CommunicationsGateways + +- [CreateOrUpdate](#communicationsgateways_createorupdate) +- [Delete](#communicationsgateways_delete) +- [GetByResourceGroup](#communicationsgateways_getbyresourcegroup) +- [List](#communicationsgateways_list) +- [ListByResourceGroup](#communicationsgateways_listbyresourcegroup) +- [Update](#communicationsgateways_update) + +## NameAvailability + +- [CheckLocal](#nameavailability_checklocal) + +## Operations + +- [List](#operations_list) + +## TestLines + +- [CreateOrUpdate](#testlines_createorupdate) +- [Delete](#testlines_delete) +- [Get](#testlines_get) +- [ListByCommunicationsGateway](#testlines_listbycommunicationsgateway) +- [Update](#testlines_update) +### CommunicationsGateways_CreateOrUpdate + +```java +import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope; +import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform; +import com.azure.resourcemanager.voiceservices.models.Connectivity; +import com.azure.resourcemanager.voiceservices.models.E911Type; +import com.azure.resourcemanager.voiceservices.models.PrimaryRegionProperties; +import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; +import com.azure.resourcemanager.voiceservices.models.TeamsCodecs; +import java.util.Arrays; + +/** Samples for CommunicationsGateways CreateOrUpdate. */ +public final class CommunicationsGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_CreateOrUpdate.json + */ + /** + * Sample code: CreateCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void createCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .communicationsGateways() + .define("myname") + .withRegion("useast") + .withExistingResourceGroup("testrg") + .withServiceLocations( + Arrays + .asList( + new ServiceRegionProperties() + .withName("useast") + .withPrimaryRegionProperties( + new PrimaryRegionProperties() + .withOperatorAddresses(Arrays.asList("198.51.100.1")) + .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("10.1.1.0/24")) + .withAllowedMediaSourceAddressPrefixes(Arrays.asList("10.1.2.0/24"))), + new ServiceRegionProperties() + .withName("useast2") + .withPrimaryRegionProperties( + new PrimaryRegionProperties() + .withOperatorAddresses(Arrays.asList("198.51.100.2")) + .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("10.2.1.0/24")) + .withAllowedMediaSourceAddressPrefixes(Arrays.asList("10.2.2.0/24"))))) + .withConnectivity(Connectivity.PUBLIC_ADDRESS) + .withCodecs(Arrays.asList(TeamsCodecs.PCMA)) + .withE911Type(E911Type.STANDARD) + .withPlatforms(Arrays.asList(CommunicationsPlatform.OPERATOR_CONNECT)) + .withAutoGeneratedDomainNameLabelScope(AutoGeneratedDomainNameLabelScope.NO_REUSE) + .withTeamsVoicemailPilotNumber("1234567890") + .create(); + } +} +``` + +### CommunicationsGateways_Delete + +```java +/** Samples for CommunicationsGateways Delete. */ +public final class CommunicationsGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Delete.json + */ + /** + * Sample code: DeleteCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void deleteCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().delete("testrg", "myname", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunicationsGateways_GetByResourceGroup + +```java +/** Samples for CommunicationsGateways GetByResourceGroup. */ +public final class CommunicationsGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Get.json + */ + /** + * Sample code: GetCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void getCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .communicationsGateways() + .getByResourceGroupWithResponse("testrg", "myname", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunicationsGateways_List + +```java +/** Samples for CommunicationsGateways List. */ +public final class CommunicationsGatewaysListSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_ListBySubscription.json + */ + /** + * Sample code: ListCommunicationsGatewayResourceSub. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listCommunicationsGatewayResourceSub( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CommunicationsGateways_ListByResourceGroup + +```java +/** Samples for CommunicationsGateways ListByResourceGroup. */ +public final class CommunicationsGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_ListByResourceGroup.json + */ + /** + * Sample code: ListCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunicationsGateways_Update + +```java +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateway; + +/** Samples for CommunicationsGateways Update. */ +public final class CommunicationsGatewaysUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Update.json + */ + /** + * Sample code: UpdateCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void updateCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + CommunicationsGateway resource = + manager + .communicationsGateways() + .getByResourceGroupWithResponse("testrg", "myname", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### NameAvailability_CheckLocal + +```java +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; + +/** Samples for NameAvailability CheckLocal. */ +public final class NameAvailabilityCheckLocalSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/NameAvailability_CheckLocal.json + */ + /** + * Sample code: CheckLocalNameAvailability. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void checkLocalNameAvailability( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .nameAvailabilities() + .checkLocalWithResponse( + "useast", + new CheckNameAvailabilityRequest() + .withName("myname") + .withType("Microsoft.VoiceServices/CommunicationsGateway"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/Operations_List.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void operationsList(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### TestLines_CreateOrUpdate + +```java +import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; + +/** Samples for TestLines CreateOrUpdate. */ +public final class TestLinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_CreateOrUpdate.json + */ + /** + * Sample code: CreateTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void createTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .testLines() + .define("myline") + .withRegion("useast") + .withExistingCommunicationsGateway("testrg", "myname") + .withPhoneNumber("+1-555-1234") + .withPurpose(TestLinePurpose.AUTOMATED) + .create(); + } +} +``` + +### TestLines_Delete + +```java +/** Samples for TestLines Delete. */ +public final class TestLinesDeleteSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Delete.json + */ + /** + * Sample code: DeleteTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void deleteTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().delete("testrg", "myname", "myline", com.azure.core.util.Context.NONE); + } +} +``` + +### TestLines_Get + +```java +/** Samples for TestLines Get. */ +public final class TestLinesGetSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Get.json + */ + /** + * Sample code: GetTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void getTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().getWithResponse("testrg", "myname", "myline", com.azure.core.util.Context.NONE); + } +} +``` + +### TestLines_ListByCommunicationsGateway + +```java +/** Samples for TestLines ListByCommunicationsGateway. */ +public final class TestLinesListByCommunicationsGatewaySamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_ListByCommunicationsGateway.json + */ + /** + * Sample code: ListTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().listByCommunicationsGateway("testrg", "myname", com.azure.core.util.Context.NONE); + } +} +``` + +### TestLines_Update + +```java +import com.azure.resourcemanager.voiceservices.models.TestLine; + +/** Samples for TestLines Update. */ +public final class TestLinesUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Update.json + */ + /** + * Sample code: UpdateTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void updateTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + TestLine resource = + manager + .testLines() + .getWithResponse("testrg", "myname", "myline", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml b/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml new file mode 100644 index 0000000000000..9602d11526cce --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-voiceservices + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for voiceservices Management + This package contains Microsoft Azure SDK for voiceservices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2023-01-31. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.36.0 + + + com.azure + azure-core-management + 1.10.1 + + + diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/VoiceservicesManager.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/VoiceservicesManager.java new file mode 100644 index 0000000000000..1a18e8537d4a5 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/VoiceservicesManager.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.voiceservices.fluent.MicrosoftVoiceServices; +import com.azure.resourcemanager.voiceservices.implementation.CommunicationsGatewaysImpl; +import com.azure.resourcemanager.voiceservices.implementation.MicrosoftVoiceServicesBuilder; +import com.azure.resourcemanager.voiceservices.implementation.NameAvailabilitiesImpl; +import com.azure.resourcemanager.voiceservices.implementation.OperationsImpl; +import com.azure.resourcemanager.voiceservices.implementation.TestLinesImpl; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateways; +import com.azure.resourcemanager.voiceservices.models.NameAvailabilities; +import com.azure.resourcemanager.voiceservices.models.Operations; +import com.azure.resourcemanager.voiceservices.models.TestLines; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to VoiceservicesManager. */ +public final class VoiceservicesManager { + private Operations operations; + + private CommunicationsGateways communicationsGateways; + + private NameAvailabilities nameAvailabilities; + + private TestLines testLines; + + private final MicrosoftVoiceServices clientObject; + + private VoiceservicesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MicrosoftVoiceServicesBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of voiceservices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the voiceservices service API instance. + */ + public static VoiceservicesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of voiceservices service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the voiceservices service API instance. + */ + public static VoiceservicesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new VoiceservicesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create VoiceservicesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new VoiceservicesManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of voiceservices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the voiceservices service API instance. + */ + public VoiceservicesManager 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.voiceservices") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new VoiceservicesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of CommunicationsGateways. It manages CommunicationsGateway. + * + * @return Resource collection API of CommunicationsGateways. + */ + public CommunicationsGateways communicationsGateways() { + if (this.communicationsGateways == null) { + this.communicationsGateways = + new CommunicationsGatewaysImpl(clientObject.getCommunicationsGateways(), this); + } + return communicationsGateways; + } + + /** + * Gets the resource collection API of NameAvailabilities. + * + * @return Resource collection API of NameAvailabilities. + */ + public NameAvailabilities nameAvailabilities() { + if (this.nameAvailabilities == null) { + this.nameAvailabilities = new NameAvailabilitiesImpl(clientObject.getNameAvailabilities(), this); + } + return nameAvailabilities; + } + + /** + * Gets the resource collection API of TestLines. It manages TestLine. + * + * @return Resource collection API of TestLines. + */ + public TestLines testLines() { + if (this.testLines == null) { + this.testLines = new TestLinesImpl(clientObject.getTestLines(), this); + } + return testLines; + } + + /** + * @return Wrapped service client MicrosoftVoiceServices providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public MicrosoftVoiceServices serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/CommunicationsGatewaysClient.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/CommunicationsGatewaysClient.java new file mode 100644 index 0000000000000..5661f283f3297 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/CommunicationsGatewaysClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.models.CommunicationsGatewayInner; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGatewayUpdate; + +/** An instance of this class provides access to all the operations defined in CommunicationsGatewaysClient. */ +public interface CommunicationsGatewaysClient { + /** + * List CommunicationsGateway resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationsGatewayName, Context context); + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationsGatewayInner getByResourceGroup(String resourceGroupName, String communicationsGatewayName); + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunicationsGatewayInner> beginCreateOrUpdate( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource); + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunicationsGatewayInner> beginCreateOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context); + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationsGatewayInner createOrUpdate( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource); + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationsGatewayInner createOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communicationsGatewayName); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, Context context); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 communicationsGatewayName); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 communicationsGatewayName, Context context); + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayUpdate properties, + Context context); + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunicationsGatewayInner update( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayUpdate properties); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/MicrosoftVoiceServices.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/MicrosoftVoiceServices.java new file mode 100644 index 0000000000000..c237a38e9851b --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/MicrosoftVoiceServices.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.voiceservices.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MicrosoftVoiceServices class. */ +public interface MicrosoftVoiceServices { + /** + * 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 CommunicationsGatewaysClient object to access its operations. + * + * @return the CommunicationsGatewaysClient object. + */ + CommunicationsGatewaysClient getCommunicationsGateways(); + + /** + * Gets the NameAvailabilitiesClient object to access its operations. + * + * @return the NameAvailabilitiesClient object. + */ + NameAvailabilitiesClient getNameAvailabilities(); + + /** + * Gets the TestLinesClient object to access its operations. + * + * @return the TestLinesClient object. + */ + TestLinesClient getTestLines(); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/NameAvailabilitiesClient.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/NameAvailabilitiesClient.java new file mode 100644 index 0000000000000..d50fac2cb9b83 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/NameAvailabilitiesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in NameAvailabilitiesClient. */ +public interface NameAvailabilitiesClient { + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkLocalWithResponse( + String location, CheckNameAvailabilityRequest body, Context context); + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/OperationsClient.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/OperationsClient.java new file mode 100644 index 0000000000000..3c69c73d23c9e --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/TestLinesClient.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/TestLinesClient.java new file mode 100644 index 0000000000000..c4b45c92ddbea --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/TestLinesClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.models.TestLineInner; +import com.azure.resourcemanager.voiceservices.models.TestLineUpdate; + +/** An instance of this class provides access to all the operations defined in TestLinesClient. */ +public interface TestLinesClient { + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName); + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName, Context context); + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context); + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestLineInner get(String resourceGroupName, String communicationsGatewayName, String testLineName); + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestLineInner> beginCreateOrUpdate( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource); + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestLineInner> beginCreateOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context); + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestLineInner createOrUpdate( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource); + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestLineInner createOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, String testLineName); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 communicationsGatewayName, String testLineName); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 communicationsGatewayName, String testLineName, Context context); + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineUpdate properties, + Context context); + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestLineInner update( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineUpdate properties); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..a5a90a62f2c30 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability result. */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + /* + * Indicates if the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + @JsonProperty(value = "reason") + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is not available. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of CheckNameAvailabilityResponseInner class. */ + public CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates if the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason why the given name is not available. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(CheckNameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed reason why the given name is not available. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayInner.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayInner.java new file mode 100644 index 0000000000000..1d947a3f802e4 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayInner.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope; +import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform; +import com.azure.resourcemanager.voiceservices.models.Connectivity; +import com.azure.resourcemanager.voiceservices.models.E911Type; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; +import com.azure.resourcemanager.voiceservices.models.Status; +import com.azure.resourcemanager.voiceservices.models.TeamsCodecs; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A CommunicationsGateway resource. */ +@Fluent +public final class CommunicationsGatewayInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private CommunicationsGatewayProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of CommunicationsGatewayInner class. */ + public CommunicationsGatewayInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CommunicationsGatewayProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public CommunicationsGatewayInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CommunicationsGatewayInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the status property: The current status of the deployment. + * + * @return the status value. + */ + public Status status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling. + * + * @return the serviceLocations value. + */ + public List serviceLocations() { + return this.innerProperties() == null ? null : this.innerProperties().serviceLocations(); + } + + /** + * Set the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling. + * + * @param serviceLocations the serviceLocations value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withServiceLocations(List serviceLocations) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withServiceLocations(serviceLocations); + return this; + } + + /** + * Get the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @return the connectivity value. + */ + public Connectivity connectivity() { + return this.innerProperties() == null ? null : this.innerProperties().connectivity(); + } + + /** + * Set the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @param connectivity the connectivity value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withConnectivity(Connectivity connectivity) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withConnectivity(connectivity); + return this; + } + + /** + * Get the codecs property: Voice codecs to support. + * + * @return the codecs value. + */ + public List codecs() { + return this.innerProperties() == null ? null : this.innerProperties().codecs(); + } + + /** + * Set the codecs property: Voice codecs to support. + * + * @param codecs the codecs value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withCodecs(List codecs) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withCodecs(codecs); + return this; + } + + /** + * Get the e911Type property: How to handle 911 calls. + * + * @return the e911Type value. + */ + public E911Type e911Type() { + return this.innerProperties() == null ? null : this.innerProperties().e911Type(); + } + + /** + * Set the e911Type property: How to handle 911 calls. + * + * @param e911Type the e911Type value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withE911Type(E911Type e911Type) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withE911Type(e911Type); + return this; + } + + /** + * Get the platforms property: What platforms to support. + * + * @return the platforms value. + */ + public List platforms() { + return this.innerProperties() == null ? null : this.innerProperties().platforms(); + } + + /** + * Set the platforms property: What platforms to support. + * + * @param platforms the platforms value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withPlatforms(List platforms) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withPlatforms(platforms); + return this; + } + + /** + * Get the apiBridge property: Details of API bridge functionality, if required. + * + * @return the apiBridge value. + */ + public Object apiBridge() { + return this.innerProperties() == null ? null : this.innerProperties().apiBridge(); + } + + /** + * Set the apiBridge property: Details of API bridge functionality, if required. + * + * @param apiBridge the apiBridge value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withApiBridge(Object apiBridge) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withApiBridge(apiBridge); + return this; + } + + /** + * Get the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be + * re-used. + * + * @return the autoGeneratedDomainNameLabelScope value. + */ + public AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope() { + return this.innerProperties() == null ? null : this.innerProperties().autoGeneratedDomainNameLabelScope(); + } + + /** + * Set the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be + * re-used. + * + * @param autoGeneratedDomainNameLabelScope the autoGeneratedDomainNameLabelScope value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withAutoGeneratedDomainNameLabelScope( + AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withAutoGeneratedDomainNameLabelScope(autoGeneratedDomainNameLabelScope); + return this; + } + + /** + * Get the autoGeneratedDomainNameLabel property: The autogenerated label used as part of the FQDNs for accessing + * the Communications Gateway. + * + * @return the autoGeneratedDomainNameLabel value. + */ + public String autoGeneratedDomainNameLabel() { + return this.innerProperties() == null ? null : this.innerProperties().autoGeneratedDomainNameLabel(); + } + + /** + * Get the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the + * voicemail IVR from the native dialer. + * + * @return the teamsVoicemailPilotNumber value. + */ + public String teamsVoicemailPilotNumber() { + return this.innerProperties() == null ? null : this.innerProperties().teamsVoicemailPilotNumber(); + } + + /** + * Set the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the + * voicemail IVR from the native dialer. + * + * @param teamsVoicemailPilotNumber the teamsVoicemailPilotNumber value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withTeamsVoicemailPilotNumber(String teamsVoicemailPilotNumber) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withTeamsVoicemailPilotNumber(teamsVoicemailPilotNumber); + return this; + } + + /** + * Get the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use. + * + * @return the onPremMcpEnabled value. + */ + public Boolean onPremMcpEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().onPremMcpEnabled(); + } + + /** + * Set the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use. + * + * @param onPremMcpEnabled the onPremMcpEnabled value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withOnPremMcpEnabled(Boolean onPremMcpEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withOnPremMcpEnabled(onPremMcpEnabled); + return this; + } + + /** + * Get the emergencyDialStrings property: A list of dial strings used for emergency calling. + * + * @return the emergencyDialStrings value. + */ + public List emergencyDialStrings() { + return this.innerProperties() == null ? null : this.innerProperties().emergencyDialStrings(); + } + + /** + * Set the emergencyDialStrings property: A list of dial strings used for emergency calling. + * + * @param emergencyDialStrings the emergencyDialStrings value to set. + * @return the CommunicationsGatewayInner object itself. + */ + public CommunicationsGatewayInner withEmergencyDialStrings(List emergencyDialStrings) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunicationsGatewayProperties(); + } + this.innerProperties().withEmergencyDialStrings(emergencyDialStrings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayProperties.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayProperties.java new file mode 100644 index 0000000000000..62714629f3f86 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/CommunicationsGatewayProperties.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.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope; +import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform; +import com.azure.resourcemanager.voiceservices.models.Connectivity; +import com.azure.resourcemanager.voiceservices.models.E911Type; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; +import com.azure.resourcemanager.voiceservices.models.Status; +import com.azure.resourcemanager.voiceservices.models.TeamsCodecs; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Details of the CommunicationsGateway resource. */ +@Fluent +public final class CommunicationsGatewayProperties { + /* + * Resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The current status of the deployment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /* + * The regions in which to deploy the resources needed for Teams Calling + */ + @JsonProperty(value = "serviceLocations", required = true) + private List serviceLocations; + + /* + * How to connect back to the operator network, e.g. MAPS + */ + @JsonProperty(value = "connectivity", required = true) + private Connectivity connectivity; + + /* + * Voice codecs to support + */ + @JsonProperty(value = "codecs", required = true) + private List codecs; + + /* + * How to handle 911 calls + */ + @JsonProperty(value = "e911Type", required = true) + private E911Type e911Type; + + /* + * What platforms to support + */ + @JsonProperty(value = "platforms", required = true) + private List platforms; + + /* + * Details of API bridge functionality, if required + */ + @JsonProperty(value = "apiBridge") + private Object apiBridge; + + /* + * The scope at which the auto-generated domain name can be re-used + */ + @JsonProperty(value = "autoGeneratedDomainNameLabelScope") + private AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope; + + /* + * The autogenerated label used as part of the FQDNs for accessing the Communications Gateway + */ + @JsonProperty(value = "autoGeneratedDomainNameLabel", access = JsonProperty.Access.WRITE_ONLY) + private String autoGeneratedDomainNameLabel; + + /* + * This number is used in Teams Phone Mobile scenarios for access to the voicemail IVR from the native dialer. + */ + @JsonProperty(value = "teamsVoicemailPilotNumber") + private String teamsVoicemailPilotNumber; + + /* + * Whether an on-premises Mobile Control Point is in use. + */ + @JsonProperty(value = "onPremMcpEnabled") + private Boolean onPremMcpEnabled; + + /* + * A list of dial strings used for emergency calling. + */ + @JsonProperty(value = "emergencyDialStrings") + private List emergencyDialStrings; + + /** Creates an instance of CommunicationsGatewayProperties class. */ + public CommunicationsGatewayProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The current status of the deployment. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling. + * + * @return the serviceLocations value. + */ + public List serviceLocations() { + return this.serviceLocations; + } + + /** + * Set the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling. + * + * @param serviceLocations the serviceLocations value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withServiceLocations(List serviceLocations) { + this.serviceLocations = serviceLocations; + return this; + } + + /** + * Get the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @return the connectivity value. + */ + public Connectivity connectivity() { + return this.connectivity; + } + + /** + * Set the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @param connectivity the connectivity value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withConnectivity(Connectivity connectivity) { + this.connectivity = connectivity; + return this; + } + + /** + * Get the codecs property: Voice codecs to support. + * + * @return the codecs value. + */ + public List codecs() { + return this.codecs; + } + + /** + * Set the codecs property: Voice codecs to support. + * + * @param codecs the codecs value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withCodecs(List codecs) { + this.codecs = codecs; + return this; + } + + /** + * Get the e911Type property: How to handle 911 calls. + * + * @return the e911Type value. + */ + public E911Type e911Type() { + return this.e911Type; + } + + /** + * Set the e911Type property: How to handle 911 calls. + * + * @param e911Type the e911Type value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withE911Type(E911Type e911Type) { + this.e911Type = e911Type; + return this; + } + + /** + * Get the platforms property: What platforms to support. + * + * @return the platforms value. + */ + public List platforms() { + return this.platforms; + } + + /** + * Set the platforms property: What platforms to support. + * + * @param platforms the platforms value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withPlatforms(List platforms) { + this.platforms = platforms; + return this; + } + + /** + * Get the apiBridge property: Details of API bridge functionality, if required. + * + * @return the apiBridge value. + */ + public Object apiBridge() { + return this.apiBridge; + } + + /** + * Set the apiBridge property: Details of API bridge functionality, if required. + * + * @param apiBridge the apiBridge value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withApiBridge(Object apiBridge) { + this.apiBridge = apiBridge; + return this; + } + + /** + * Get the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be + * re-used. + * + * @return the autoGeneratedDomainNameLabelScope value. + */ + public AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope() { + return this.autoGeneratedDomainNameLabelScope; + } + + /** + * Set the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be + * re-used. + * + * @param autoGeneratedDomainNameLabelScope the autoGeneratedDomainNameLabelScope value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withAutoGeneratedDomainNameLabelScope( + AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope) { + this.autoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; + return this; + } + + /** + * Get the autoGeneratedDomainNameLabel property: The autogenerated label used as part of the FQDNs for accessing + * the Communications Gateway. + * + * @return the autoGeneratedDomainNameLabel value. + */ + public String autoGeneratedDomainNameLabel() { + return this.autoGeneratedDomainNameLabel; + } + + /** + * Get the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the + * voicemail IVR from the native dialer. + * + * @return the teamsVoicemailPilotNumber value. + */ + public String teamsVoicemailPilotNumber() { + return this.teamsVoicemailPilotNumber; + } + + /** + * Set the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to the + * voicemail IVR from the native dialer. + * + * @param teamsVoicemailPilotNumber the teamsVoicemailPilotNumber value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withTeamsVoicemailPilotNumber(String teamsVoicemailPilotNumber) { + this.teamsVoicemailPilotNumber = teamsVoicemailPilotNumber; + return this; + } + + /** + * Get the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use. + * + * @return the onPremMcpEnabled value. + */ + public Boolean onPremMcpEnabled() { + return this.onPremMcpEnabled; + } + + /** + * Set the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use. + * + * @param onPremMcpEnabled the onPremMcpEnabled value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withOnPremMcpEnabled(Boolean onPremMcpEnabled) { + this.onPremMcpEnabled = onPremMcpEnabled; + return this; + } + + /** + * Get the emergencyDialStrings property: A list of dial strings used for emergency calling. + * + * @return the emergencyDialStrings value. + */ + public List emergencyDialStrings() { + return this.emergencyDialStrings; + } + + /** + * Set the emergencyDialStrings property: A list of dial strings used for emergency calling. + * + * @param emergencyDialStrings the emergencyDialStrings value to set. + * @return the CommunicationsGatewayProperties object itself. + */ + public CommunicationsGatewayProperties withEmergencyDialStrings(List emergencyDialStrings) { + this.emergencyDialStrings = emergencyDialStrings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceLocations() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serviceLocations in model CommunicationsGatewayProperties")); + } else { + serviceLocations().forEach(e -> e.validate()); + } + if (connectivity() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectivity in model CommunicationsGatewayProperties")); + } + if (codecs() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property codecs in model CommunicationsGatewayProperties")); + } + if (e911Type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property e911Type in model CommunicationsGatewayProperties")); + } + if (platforms() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property platforms in model CommunicationsGatewayProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunicationsGatewayProperties.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/OperationInner.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..9e828858c2ab3 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.voiceservices.models.ActionType; +import com.azure.resourcemanager.voiceservices.models.OperationDisplay; +import com.azure.resourcemanager.voiceservices.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineInner.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineInner.java new file mode 100644 index 0000000000000..847910ed4037a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A TestLine resource. */ +@Fluent +public final class TestLineInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private TestLineProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of TestLineInner class. */ + public TestLineInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private TestLineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public TestLineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TestLineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the phoneNumber property: The phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.innerProperties() == null ? null : this.innerProperties().phoneNumber(); + } + + /** + * Set the phoneNumber property: The phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the TestLineInner object itself. + */ + public TestLineInner withPhoneNumber(String phoneNumber) { + if (this.innerProperties() == null) { + this.innerProperties = new TestLineProperties(); + } + this.innerProperties().withPhoneNumber(phoneNumber); + return this; + } + + /** + * Get the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @return the purpose value. + */ + public TestLinePurpose purpose() { + return this.innerProperties() == null ? null : this.innerProperties().purpose(); + } + + /** + * Set the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @param purpose the purpose value to set. + * @return the TestLineInner object itself. + */ + public TestLineInner withPurpose(TestLinePurpose purpose) { + if (this.innerProperties() == null) { + this.innerProperties = new TestLineProperties(); + } + this.innerProperties().withPurpose(purpose); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineProperties.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineProperties.java new file mode 100644 index 0000000000000..44152c2aa7c83 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/TestLineProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the TestLine resource. */ +@Fluent +public final class TestLineProperties { + /* + * Resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The phone number + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /* + * Purpose of this test line, e.g. automated or manual testing + */ + @JsonProperty(value = "purpose", required = true) + private TestLinePurpose purpose; + + /** Creates an instance of TestLineProperties class. */ + public TestLineProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the phoneNumber property: The phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the TestLineProperties object itself. + */ + public TestLineProperties withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @return the purpose value. + */ + public TestLinePurpose purpose() { + return this.purpose; + } + + /** + * Set the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @param purpose the purpose value to set. + * @return the TestLineProperties object itself. + */ + public TestLineProperties withPurpose(TestLinePurpose purpose) { + this.purpose = purpose; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (phoneNumber() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phoneNumber in model TestLineProperties")); + } + if (purpose() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property purpose in model TestLineProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TestLineProperties.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/package-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/package-info.java new file mode 100644 index 0000000000000..69beb2b091328 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MicrosoftVoiceServices. null. */ +package com.azure.resourcemanager.voiceservices.fluent.models; diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/package-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/package-info.java new file mode 100644 index 0000000000000..f46738393017c --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MicrosoftVoiceServices. null. */ +package com.azure.resourcemanager.voiceservices.fluent; diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..73e60c6525f8d --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewayImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewayImpl.java new file mode 100644 index 0000000000000..f166c7cce7865 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewayImpl.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner; +import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateway; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGatewayUpdate; +import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform; +import com.azure.resourcemanager.voiceservices.models.Connectivity; +import com.azure.resourcemanager.voiceservices.models.E911Type; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; +import com.azure.resourcemanager.voiceservices.models.Status; +import com.azure.resourcemanager.voiceservices.models.TeamsCodecs; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CommunicationsGatewayImpl + implements CommunicationsGateway, CommunicationsGateway.Definition, CommunicationsGateway.Update { + private CommunicationsGatewayInner innerObject; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Status status() { + return this.innerModel().status(); + } + + public List serviceLocations() { + List inner = this.innerModel().serviceLocations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Connectivity connectivity() { + return this.innerModel().connectivity(); + } + + public List codecs() { + List inner = this.innerModel().codecs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public E911Type e911Type() { + return this.innerModel().e911Type(); + } + + public List platforms() { + List inner = this.innerModel().platforms(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Object apiBridge() { + return this.innerModel().apiBridge(); + } + + public AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope() { + return this.innerModel().autoGeneratedDomainNameLabelScope(); + } + + public String autoGeneratedDomainNameLabel() { + return this.innerModel().autoGeneratedDomainNameLabel(); + } + + public String teamsVoicemailPilotNumber() { + return this.innerModel().teamsVoicemailPilotNumber(); + } + + public Boolean onPremMcpEnabled() { + return this.innerModel().onPremMcpEnabled(); + } + + public List emergencyDialStrings() { + List inner = this.innerModel().emergencyDialStrings(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CommunicationsGatewayInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communicationsGatewayName; + + private CommunicationsGatewayUpdate updateProperties; + + public CommunicationsGatewayImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CommunicationsGateway create() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .createOrUpdate(resourceGroupName, communicationsGatewayName, this.innerModel(), Context.NONE); + return this; + } + + public CommunicationsGateway create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .createOrUpdate(resourceGroupName, communicationsGatewayName, this.innerModel(), context); + return this; + } + + CommunicationsGatewayImpl( + String name, com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerObject = new CommunicationsGatewayInner(); + this.serviceManager = serviceManager; + this.communicationsGatewayName = name; + } + + public CommunicationsGatewayImpl update() { + this.updateProperties = new CommunicationsGatewayUpdate(); + return this; + } + + public CommunicationsGateway apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .updateWithResponse(resourceGroupName, communicationsGatewayName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public CommunicationsGateway apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .updateWithResponse(resourceGroupName, communicationsGatewayName, updateProperties, context) + .getValue(); + return this; + } + + CommunicationsGatewayImpl( + CommunicationsGatewayInner innerObject, + com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communicationsGatewayName = Utils.getValueFromIdByName(innerObject.id(), "communicationsGateways"); + } + + public CommunicationsGateway refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, Context.NONE) + .getValue(); + return this; + } + + public CommunicationsGateway refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationsGateways() + .getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, context) + .getValue(); + return this; + } + + public CommunicationsGatewayImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CommunicationsGatewayImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CommunicationsGatewayImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CommunicationsGatewayImpl withServiceLocations(List serviceLocations) { + this.innerModel().withServiceLocations(serviceLocations); + return this; + } + + public CommunicationsGatewayImpl withConnectivity(Connectivity connectivity) { + this.innerModel().withConnectivity(connectivity); + return this; + } + + public CommunicationsGatewayImpl withCodecs(List codecs) { + this.innerModel().withCodecs(codecs); + return this; + } + + public CommunicationsGatewayImpl withE911Type(E911Type e911Type) { + this.innerModel().withE911Type(e911Type); + return this; + } + + public CommunicationsGatewayImpl withPlatforms(List platforms) { + this.innerModel().withPlatforms(platforms); + return this; + } + + public CommunicationsGatewayImpl withApiBridge(Object apiBridge) { + this.innerModel().withApiBridge(apiBridge); + return this; + } + + public CommunicationsGatewayImpl withAutoGeneratedDomainNameLabelScope( + AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope) { + this.innerModel().withAutoGeneratedDomainNameLabelScope(autoGeneratedDomainNameLabelScope); + return this; + } + + public CommunicationsGatewayImpl withTeamsVoicemailPilotNumber(String teamsVoicemailPilotNumber) { + this.innerModel().withTeamsVoicemailPilotNumber(teamsVoicemailPilotNumber); + return this; + } + + public CommunicationsGatewayImpl withOnPremMcpEnabled(Boolean onPremMcpEnabled) { + this.innerModel().withOnPremMcpEnabled(onPremMcpEnabled); + return this; + } + + public CommunicationsGatewayImpl withEmergencyDialStrings(List emergencyDialStrings) { + this.innerModel().withEmergencyDialStrings(emergencyDialStrings); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysClientImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysClientImpl.java new file mode 100644 index 0000000000000..575352abb39bc --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysClientImpl.java @@ -0,0 +1,1494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.voiceservices.fluent.CommunicationsGatewaysClient; +import com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGatewayListResult; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGatewayUpdate; +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 CommunicationsGatewaysClient. */ +public final class CommunicationsGatewaysClientImpl implements CommunicationsGatewaysClient { + /** The proxy service used to perform REST calls. */ + private final CommunicationsGatewaysService service; + + /** The service client containing this operation class. */ + private final MicrosoftVoiceServicesImpl client; + + /** + * Initializes an instance of CommunicationsGatewaysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunicationsGatewaysClientImpl(MicrosoftVoiceServicesImpl client) { + this.service = + RestProxy + .create(CommunicationsGatewaysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftVoiceServicesCommunicationsGateways to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftVoiceServic") + public interface CommunicationsGatewaysService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/communicationsGateways") + @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.VoiceServices" + + "/communicationsGateways") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @BodyParam("application/json") CommunicationsGatewayInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @BodyParam("application/json") CommunicationsGatewayUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunicationsGateway along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String communicationsGatewayName) { + 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName 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, + communicationsGatewayName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName 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, + communicationsGatewayName, + accept, + context); + } + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunicationsGateway on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String communicationsGatewayName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communicationsGatewayName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationsGatewayName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communicationsGatewayName, context).block(); + } + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 CommunicationsGateway. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationsGatewayInner getByResourceGroup(String resourceGroupName, String communicationsGatewayName) { + return getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, Context.NONE).getValue(); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + resource, + accept, + context); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunicationsGatewayInner> beginCreateOrUpdateAsync( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, communicationsGatewayName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CommunicationsGatewayInner.class, + CommunicationsGatewayInner.class, + this.client.getContext()); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunicationsGatewayInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, communicationsGatewayName, resource, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CommunicationsGatewayInner.class, + CommunicationsGatewayInner.class, + context); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunicationsGatewayInner> beginCreateOrUpdate( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource).getSyncPoller(); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunicationsGatewayInner> beginCreateOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource, context) + .getSyncPoller(); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationsGatewayInner createOrUpdate( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayInner resource) { + return createOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource).block(); + } + + /** + * Create a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationsGatewayInner createOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, communicationsGatewayName, resource, context).block(); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationsGatewayName) { + 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName 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, + communicationsGatewayName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName 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, + communicationsGatewayName, + accept, + context); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationsGatewayName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communicationsGatewayName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationsGatewayName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, communicationsGatewayName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communicationsGatewayName) { + return this.beginDeleteAsync(resourceGroupName, communicationsGatewayName).getSyncPoller(); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, Context context) { + return this.beginDeleteAsync(resourceGroupName, communicationsGatewayName, context).getSyncPoller(); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communicationsGatewayName) { + return beginDeleteAsync(resourceGroupName, communicationsGatewayName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communicationsGatewayName, Context context) { + return beginDeleteAsync(resourceGroupName, communicationsGatewayName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 communicationsGatewayName) { + deleteAsync(resourceGroupName, communicationsGatewayName).block(); + } + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 communicationsGatewayName, Context context) { + deleteAsync(resourceGroupName, communicationsGatewayName, context).block(); + } + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayUpdate properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + properties, + accept, + context); + } + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayUpdate properties) { + return updateWithResponseAsync(resourceGroupName, communicationsGatewayName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String communicationsGatewayName, + CommunicationsGatewayUpdate properties, + Context context) { + return updateWithResponseAsync(resourceGroupName, communicationsGatewayName, properties, context).block(); + } + + /** + * Update a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunicationsGatewayInner update( + String resourceGroupName, String communicationsGatewayName, CommunicationsGatewayUpdate properties) { + return updateWithResponse(resourceGroupName, communicationsGatewayName, properties, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysImpl.java new file mode 100644 index 0000000000000..ba3b22b9d2536 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/CommunicationsGatewaysImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.CommunicationsGatewaysClient; +import com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateway; +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateways; + +public final class CommunicationsGatewaysImpl implements CommunicationsGateways { + private static final ClientLogger LOGGER = new ClientLogger(CommunicationsGatewaysImpl.class); + + private final CommunicationsGatewaysClient innerClient; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public CommunicationsGatewaysImpl( + CommunicationsGatewaysClient innerClient, + com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CommunicationsGatewayImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CommunicationsGatewayImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CommunicationsGatewayImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CommunicationsGatewayImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationsGatewayName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CommunicationsGatewayImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunicationsGateway getByResourceGroup(String resourceGroupName, String communicationsGatewayName) { + CommunicationsGatewayInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, communicationsGatewayName); + if (inner != null) { + return new CommunicationsGatewayImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String communicationsGatewayName) { + this.serviceClient().delete(resourceGroupName, communicationsGatewayName); + } + + public void delete(String resourceGroupName, String communicationsGatewayName, Context context) { + this.serviceClient().delete(resourceGroupName, communicationsGatewayName, context); + } + + public CommunicationsGateway getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communicationsGatewayName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + this.delete(resourceGroupName, communicationsGatewayName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + this.delete(resourceGroupName, communicationsGatewayName, context); + } + + private CommunicationsGatewaysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } + + public CommunicationsGatewayImpl define(String name) { + return new CommunicationsGatewayImpl(name, this.manager()); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesBuilder.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesBuilder.java new file mode 100644 index 0000000000000..80b9f0e6952c6 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the MicrosoftVoiceServicesImpl type. */ +@ServiceClientBuilder(serviceClients = {MicrosoftVoiceServicesImpl.class}) +public final class MicrosoftVoiceServicesBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder 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 MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the MicrosoftVoiceServicesBuilder. + */ + public MicrosoftVoiceServicesBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftVoiceServicesImpl with the provided parameters. + * + * @return an instance of MicrosoftVoiceServicesImpl. + */ + public MicrosoftVoiceServicesImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MicrosoftVoiceServicesImpl client = + new MicrosoftVoiceServicesImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesImpl.java new file mode 100644 index 0000000000000..234f0069af98a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/MicrosoftVoiceServicesImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.voiceservices.fluent.CommunicationsGatewaysClient; +import com.azure.resourcemanager.voiceservices.fluent.MicrosoftVoiceServices; +import com.azure.resourcemanager.voiceservices.fluent.NameAvailabilitiesClient; +import com.azure.resourcemanager.voiceservices.fluent.OperationsClient; +import com.azure.resourcemanager.voiceservices.fluent.TestLinesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MicrosoftVoiceServicesImpl type. */ +@ServiceClient(builder = MicrosoftVoiceServicesBuilder.class) +public final class MicrosoftVoiceServicesImpl implements MicrosoftVoiceServices { + /** 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 CommunicationsGatewaysClient object to access its operations. */ + private final CommunicationsGatewaysClient communicationsGateways; + + /** + * Gets the CommunicationsGatewaysClient object to access its operations. + * + * @return the CommunicationsGatewaysClient object. + */ + public CommunicationsGatewaysClient getCommunicationsGateways() { + return this.communicationsGateways; + } + + /** The NameAvailabilitiesClient object to access its operations. */ + private final NameAvailabilitiesClient nameAvailabilities; + + /** + * Gets the NameAvailabilitiesClient object to access its operations. + * + * @return the NameAvailabilitiesClient object. + */ + public NameAvailabilitiesClient getNameAvailabilities() { + return this.nameAvailabilities; + } + + /** The TestLinesClient object to access its operations. */ + private final TestLinesClient testLines; + + /** + * Gets the TestLinesClient object to access its operations. + * + * @return the TestLinesClient object. + */ + public TestLinesClient getTestLines() { + return this.testLines; + } + + /** + * Initializes an instance of MicrosoftVoiceServices 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. + */ + MicrosoftVoiceServicesImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-01-31"; + this.operations = new OperationsClientImpl(this); + this.communicationsGateways = new CommunicationsGatewaysClientImpl(this); + this.nameAvailabilities = new NameAvailabilitiesClientImpl(this); + this.testLines = new TestLinesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MicrosoftVoiceServicesImpl.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesClientImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesClientImpl.java new file mode 100644 index 0000000000000..d8f20d6d68072 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesClientImpl.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.voiceservices.fluent.NameAvailabilitiesClient; +import com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in NameAvailabilitiesClient. */ +public final class NameAvailabilitiesClientImpl implements NameAvailabilitiesClient { + /** The proxy service used to perform REST calls. */ + private final NameAvailabilitiesService service; + + /** The service client containing this operation class. */ + private final MicrosoftVoiceServicesImpl client; + + /** + * Initializes an instance of NameAvailabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NameAvailabilitiesClientImpl(MicrosoftVoiceServicesImpl client) { + this.service = + RestProxy.create(NameAvailabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftVoiceServicesNameAvailabilities to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftVoiceServic") + public interface NameAvailabilitiesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.VoiceServices/locations/{location}" + + "/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkLocal( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkLocalWithResponseAsync( + String location, CheckNameAvailabilityRequest body) { + 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkLocal( + this.client.getEndpoint(), + location, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkLocalWithResponseAsync( + String location, CheckNameAvailabilityRequest body, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkLocal( + this.client.getEndpoint(), + location, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkLocalAsync( + String location, CheckNameAvailabilityRequest body) { + return checkLocalWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkLocalWithResponse( + String location, CheckNameAvailabilityRequest body, Context context) { + return checkLocalWithResponseAsync(location, body, context).block(); + } + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body) { + return checkLocalWithResponse(location, body, Context.NONE).getValue(); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesImpl.java new file mode 100644 index 0000000000000..5ecd4a5b9c8d6 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/NameAvailabilitiesImpl.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.voiceservices.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.voiceservices.fluent.NameAvailabilitiesClient; +import com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.voiceservices.models.NameAvailabilities; + +public final class NameAvailabilitiesImpl implements NameAvailabilities { + private static final ClientLogger LOGGER = new ClientLogger(NameAvailabilitiesImpl.class); + + private final NameAvailabilitiesClient innerClient; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public NameAvailabilitiesImpl( + NameAvailabilitiesClient innerClient, + com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkLocalWithResponse( + String location, CheckNameAvailabilityRequest body, Context context) { + Response inner = + this.serviceClient().checkLocalWithResponse(location, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkLocal(location, body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private NameAvailabilitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationImpl.java new file mode 100644 index 0000000000000..12d0eeb091505 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/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.voiceservices.implementation; + +import com.azure.resourcemanager.voiceservices.fluent.models.OperationInner; +import com.azure.resourcemanager.voiceservices.models.ActionType; +import com.azure.resourcemanager.voiceservices.models.Operation; +import com.azure.resourcemanager.voiceservices.models.OperationDisplay; +import com.azure.resourcemanager.voiceservices.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.voiceservices.VoiceservicesManager 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.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsClientImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..34d8f46bb430a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.voiceservices.fluent.OperationsClient; +import com.azure.resourcemanager.voiceservices.fluent.models.OperationInner; +import com.azure.resourcemanager.voiceservices.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftVoiceServicesImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftVoiceServicesImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftVoiceServicesOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftVoiceServic") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.VoiceServices/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..9c4f1b57614ac --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.OperationsClient; +import com.azure.resourcemanager.voiceservices.fluent.models.OperationInner; +import com.azure.resourcemanager.voiceservices.models.Operation; +import com.azure.resourcemanager.voiceservices.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.voiceservices.VoiceservicesManager 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.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLineImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLineImpl.java new file mode 100644 index 0000000000000..4164f12df3edc --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLineImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; +import com.azure.resourcemanager.voiceservices.models.ProvisioningState; +import com.azure.resourcemanager.voiceservices.models.TestLine; +import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; +import com.azure.resourcemanager.voiceservices.models.TestLineUpdate; +import java.util.Collections; +import java.util.Map; + +public final class TestLineImpl implements TestLine, TestLine.Definition, TestLine.Update { + private TestLineInner innerObject; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String phoneNumber() { + return this.innerModel().phoneNumber(); + } + + public TestLinePurpose purpose() { + return this.innerModel().purpose(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TestLineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communicationsGatewayName; + + private String testLineName; + + private TestLineUpdate updateProperties; + + public TestLineImpl withExistingCommunicationsGateway(String resourceGroupName, String communicationsGatewayName) { + this.resourceGroupName = resourceGroupName; + this.communicationsGatewayName = communicationsGatewayName; + return this; + } + + public TestLine create() { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .createOrUpdate( + resourceGroupName, communicationsGatewayName, testLineName, this.innerModel(), Context.NONE); + return this; + } + + public TestLine create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .createOrUpdate(resourceGroupName, communicationsGatewayName, testLineName, this.innerModel(), context); + return this; + } + + TestLineImpl(String name, com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerObject = new TestLineInner(); + this.serviceManager = serviceManager; + this.testLineName = name; + } + + public TestLineImpl update() { + this.updateProperties = new TestLineUpdate(); + return this; + } + + public TestLine apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .updateWithResponse( + resourceGroupName, communicationsGatewayName, testLineName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public TestLine apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .updateWithResponse( + resourceGroupName, communicationsGatewayName, testLineName, updateProperties, context) + .getValue(); + return this; + } + + TestLineImpl( + TestLineInner innerObject, com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communicationsGatewayName = Utils.getValueFromIdByName(innerObject.id(), "communicationsGateways"); + this.testLineName = Utils.getValueFromIdByName(innerObject.id(), "testLines"); + } + + public TestLine refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, Context.NONE) + .getValue(); + return this; + } + + public TestLine refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestLines() + .getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, context) + .getValue(); + return this; + } + + public TestLineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TestLineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TestLineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public TestLineImpl withPhoneNumber(String phoneNumber) { + this.innerModel().withPhoneNumber(phoneNumber); + return this; + } + + public TestLineImpl withPurpose(TestLinePurpose purpose) { + this.innerModel().withPurpose(purpose); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesClientImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesClientImpl.java new file mode 100644 index 0000000000000..7efa1cfaa8f59 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesClientImpl.java @@ -0,0 +1,1360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.voiceservices.fluent.TestLinesClient; +import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; +import com.azure.resourcemanager.voiceservices.models.TestLineListResult; +import com.azure.resourcemanager.voiceservices.models.TestLineUpdate; +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 TestLinesClient. */ +public final class TestLinesClientImpl implements TestLinesClient { + /** The proxy service used to perform REST calls. */ + private final TestLinesService service; + + /** The service client containing this operation class. */ + private final MicrosoftVoiceServicesImpl client; + + /** + * Initializes an instance of TestLinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestLinesClientImpl(MicrosoftVoiceServicesImpl client) { + this.service = + RestProxy.create(TestLinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftVoiceServicesTestLines to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftVoiceServic") + public interface TestLinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}/testLines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunicationsGateway( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationsGatewayName") String communicationsGatewayName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("communicationsGatewayName") String communicationsGatewayName, + @PathParam("testLineName") String testLineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @PathParam("testLineName") String testLineName, + @BodyParam("application/json") TestLineInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @PathParam("testLineName") String testLineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VoiceServices" + + "/communicationsGateways/{communicationsGatewayName}/testLines/{testLineName}") + @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("communicationsGatewayName") String communicationsGatewayName, + @PathParam("testLineName") String testLineName, + @BodyParam("application/json") TestLineUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunicationsGatewayNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunicationsGatewaySinglePageAsync( + String resourceGroupName, String communicationsGatewayName) { + 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCommunicationsGateway( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunicationsGatewaySinglePageAsync( + String resourceGroupName, String communicationsGatewayName, 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCommunicationsGateway( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunicationsGatewayAsync( + String resourceGroupName, String communicationsGatewayName) { + return new PagedFlux<>( + () -> listByCommunicationsGatewaySinglePageAsync(resourceGroupName, communicationsGatewayName), + nextLink -> listByCommunicationsGatewayNextSinglePageAsync(nextLink)); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunicationsGatewayAsync( + String resourceGroupName, String communicationsGatewayName, Context context) { + return new PagedFlux<>( + () -> listByCommunicationsGatewaySinglePageAsync(resourceGroupName, communicationsGatewayName, context), + nextLink -> listByCommunicationsGatewayNextSinglePageAsync(nextLink, context)); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName) { + return new PagedIterable<>(listByCommunicationsGatewayAsync(resourceGroupName, communicationsGatewayName)); + } + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName, Context context) { + return new PagedIterable<>( + listByCommunicationsGatewayAsync(resourceGroupName, communicationsGatewayName, context)); + } + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 TestLine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName) { + 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName 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(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + accept, + context); + } + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 TestLine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName) { + return getWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + return getWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName, context).block(); + } + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 TestLine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestLineInner get(String resourceGroupName, String communicationsGatewayName, String testLineName) { + return getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, Context.NONE).getValue(); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + resource, + accept, + context); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestLineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestLineInner.class, + TestLineInner.class, + this.client.getContext()); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestLineInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, communicationsGatewayName, testLineName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TestLineInner.class, TestLineInner.class, context); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestLineInner> beginCreateOrUpdate( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource) + .getSyncPoller(); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestLineInner> beginCreateOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource, context) + .getSyncPoller(); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestLineInner createOrUpdate( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineInner resource) { + return createOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource).block(); + } + + /** + * Create a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestLineInner createOrUpdate( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, communicationsGatewayName, testLineName, resource, context) + .block(); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName) { + 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName 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, + communicationsGatewayName, + testLineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, 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 (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName 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, + communicationsGatewayName, + testLineName, + accept, + context); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, String testLineName) { + return this.beginDeleteAsync(resourceGroupName, communicationsGatewayName, testLineName).getSyncPoller(); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + return this + .beginDeleteAsync(resourceGroupName, communicationsGatewayName, testLineName, context) + .getSyncPoller(); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communicationsGatewayName, String testLineName) { + return beginDeleteAsync(resourceGroupName, communicationsGatewayName, testLineName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + return beginDeleteAsync(resourceGroupName, communicationsGatewayName, testLineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 communicationsGatewayName, String testLineName) { + deleteAsync(resourceGroupName, communicationsGatewayName, testLineName).block(); + } + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 communicationsGatewayName, String testLineName, Context context) { + deleteAsync(resourceGroupName, communicationsGatewayName, testLineName, context).block(); + } + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineUpdate properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communicationsGatewayName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter communicationsGatewayName is required and cannot be null.")); + } + if (testLineName == null) { + return Mono.error(new IllegalArgumentException("Parameter testLineName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + communicationsGatewayName, + testLineName, + properties, + accept, + context); + } + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineUpdate properties) { + return updateWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String communicationsGatewayName, + String testLineName, + TestLineUpdate properties, + Context context) { + return updateWithResponseAsync(resourceGroupName, communicationsGatewayName, testLineName, properties, context) + .block(); + } + + /** + * Update a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestLineInner update( + String resourceGroupName, String communicationsGatewayName, String testLineName, TestLineUpdate properties) { + return updateWithResponse(resourceGroupName, communicationsGatewayName, testLineName, properties, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunicationsGatewayNextSinglePageAsync(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.listByCommunicationsGatewayNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunicationsGatewayNextSinglePageAsync( + 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 + .listByCommunicationsGatewayNext(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/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesImpl.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesImpl.java new file mode 100644 index 0000000000000..dba0c112048da --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/TestLinesImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.TestLinesClient; +import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; +import com.azure.resourcemanager.voiceservices.models.TestLine; +import com.azure.resourcemanager.voiceservices.models.TestLines; + +public final class TestLinesImpl implements TestLines { + private static final ClientLogger LOGGER = new ClientLogger(TestLinesImpl.class); + + private final TestLinesClient innerClient; + + private final com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager; + + public TestLinesImpl( + TestLinesClient innerClient, com.azure.resourcemanager.voiceservices.VoiceservicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName) { + PagedIterable inner = + this.serviceClient().listByCommunicationsGateway(resourceGroupName, communicationsGatewayName); + return Utils.mapPage(inner, inner1 -> new TestLineImpl(inner1, this.manager())); + } + + public PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName, Context context) { + PagedIterable inner = + this.serviceClient().listByCommunicationsGateway(resourceGroupName, communicationsGatewayName, context); + return Utils.mapPage(inner, inner1 -> new TestLineImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestLineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestLine get(String resourceGroupName, String communicationsGatewayName, String testLineName) { + TestLineInner inner = this.serviceClient().get(resourceGroupName, communicationsGatewayName, testLineName); + if (inner != null) { + return new TestLineImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String communicationsGatewayName, String testLineName) { + this.serviceClient().delete(resourceGroupName, communicationsGatewayName, testLineName); + } + + public void delete( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context) { + this.serviceClient().delete(resourceGroupName, communicationsGatewayName, testLineName, context); + } + + public TestLine getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + String testLineName = Utils.getValueFromIdByName(id, "testLines"); + if (testLineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'testLines'.", id))); + } + return this + .getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + String testLineName = Utils.getValueFromIdByName(id, "testLines"); + if (testLineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'testLines'.", id))); + } + return this.getWithResponse(resourceGroupName, communicationsGatewayName, testLineName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + String testLineName = Utils.getValueFromIdByName(id, "testLines"); + if (testLineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'testLines'.", id))); + } + this.delete(resourceGroupName, communicationsGatewayName, testLineName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communicationsGatewayName = Utils.getValueFromIdByName(id, "communicationsGateways"); + if (communicationsGatewayName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationsGateways'.", + id))); + } + String testLineName = Utils.getValueFromIdByName(id, "testLines"); + if (testLineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'testLines'.", id))); + } + this.delete(resourceGroupName, communicationsGatewayName, testLineName, context); + } + + private TestLinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.voiceservices.VoiceservicesManager manager() { + return this.serviceManager; + } + + public TestLineImpl define(String name) { + return new TestLineImpl(name, this.manager()); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/Utils.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/Utils.java new file mode 100644 index 0000000000000..7e21383e04ff2 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/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.voiceservices.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/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/package-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/package-info.java new file mode 100644 index 0000000000000..c7157907e1235 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MicrosoftVoiceServices. null. */ +package com.azure.resourcemanager.voiceservices.implementation; diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ActionType.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ActionType.java new file mode 100644 index 0000000000000..167cfef78e8de --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/AutoGeneratedDomainNameLabelScope.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/AutoGeneratedDomainNameLabelScope.java new file mode 100644 index 0000000000000..5162d78ae4721 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/AutoGeneratedDomainNameLabelScope.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Available auto-generated domain name scopes. */ +public final class AutoGeneratedDomainNameLabelScope extends ExpandableStringEnum { + /** Static value TenantReuse for AutoGeneratedDomainNameLabelScope. */ + public static final AutoGeneratedDomainNameLabelScope TENANT_REUSE = fromString("TenantReuse"); + + /** Static value SubscriptionReuse for AutoGeneratedDomainNameLabelScope. */ + public static final AutoGeneratedDomainNameLabelScope SUBSCRIPTION_REUSE = fromString("SubscriptionReuse"); + + /** Static value ResourceGroupReuse for AutoGeneratedDomainNameLabelScope. */ + public static final AutoGeneratedDomainNameLabelScope RESOURCE_GROUP_REUSE = fromString("ResourceGroupReuse"); + + /** Static value NoReuse for AutoGeneratedDomainNameLabelScope. */ + public static final AutoGeneratedDomainNameLabelScope NO_REUSE = fromString("NoReuse"); + + /** + * Creates a new instance of AutoGeneratedDomainNameLabelScope value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AutoGeneratedDomainNameLabelScope() { + } + + /** + * Creates or finds a AutoGeneratedDomainNameLabelScope from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoGeneratedDomainNameLabelScope. + */ + @JsonCreator + public static AutoGeneratedDomainNameLabelScope fromString(String name) { + return fromString(name, AutoGeneratedDomainNameLabelScope.class); + } + + /** + * Gets known AutoGeneratedDomainNameLabelScope values. + * + * @return known AutoGeneratedDomainNameLabelScope values. + */ + public static Collection values() { + return values(AutoGeneratedDomainNameLabelScope.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityReason.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..8eabfbb5cd441 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityReason.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Possible reasons for a name not being available. */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityRequest.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..e1e0c50d9172e --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability request body. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityResponse.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..10e56291184ae --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CheckNameAvailabilityResponse.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.voiceservices.models; + +import com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.voiceservices.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateway.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateway.java new file mode 100644 index 0000000000000..10d00cf854dad --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateway.java @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CommunicationsGateway. */ +public interface CommunicationsGateway { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the status property: The current status of the deployment. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the serviceLocations property: The regions in which to deploy the resources needed for Teams Calling. + * + * @return the serviceLocations value. + */ + List serviceLocations(); + + /** + * Gets the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @return the connectivity value. + */ + Connectivity connectivity(); + + /** + * Gets the codecs property: Voice codecs to support. + * + * @return the codecs value. + */ + List codecs(); + + /** + * Gets the e911Type property: How to handle 911 calls. + * + * @return the e911Type value. + */ + E911Type e911Type(); + + /** + * Gets the platforms property: What platforms to support. + * + * @return the platforms value. + */ + List platforms(); + + /** + * Gets the apiBridge property: Details of API bridge functionality, if required. + * + * @return the apiBridge value. + */ + Object apiBridge(); + + /** + * Gets the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain name can be + * re-used. + * + * @return the autoGeneratedDomainNameLabelScope value. + */ + AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope(); + + /** + * Gets the autoGeneratedDomainNameLabel property: The autogenerated label used as part of the FQDNs for accessing + * the Communications Gateway. + * + * @return the autoGeneratedDomainNameLabel value. + */ + String autoGeneratedDomainNameLabel(); + + /** + * Gets the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for access to + * the voicemail IVR from the native dialer. + * + * @return the teamsVoicemailPilotNumber value. + */ + String teamsVoicemailPilotNumber(); + + /** + * Gets the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use. + * + * @return the onPremMcpEnabled value. + */ + Boolean onPremMcpEnabled(); + + /** + * Gets the emergencyDialStrings property: A list of dial strings used for emergency calling. + * + * @return the emergencyDialStrings value. + */ + List emergencyDialStrings(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner object. + * + * @return the inner object. + */ + CommunicationsGatewayInner innerModel(); + + /** The entirety of the CommunicationsGateway definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The CommunicationsGateway definition stages. */ + interface DefinitionStages { + /** The first stage of the CommunicationsGateway definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CommunicationsGateway definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the CommunicationsGateway definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the CommunicationsGateway definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithServiceLocations, + DefinitionStages.WithConnectivity, + DefinitionStages.WithCodecs, + DefinitionStages.WithE911Type, + DefinitionStages.WithPlatforms, + DefinitionStages.WithApiBridge, + DefinitionStages.WithAutoGeneratedDomainNameLabelScope, + DefinitionStages.WithTeamsVoicemailPilotNumber, + DefinitionStages.WithOnPremMcpEnabled, + DefinitionStages.WithEmergencyDialStrings { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommunicationsGateway create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommunicationsGateway create(Context context); + } + /** The stage of the CommunicationsGateway definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CommunicationsGateway definition allowing to specify serviceLocations. */ + interface WithServiceLocations { + /** + * Specifies the serviceLocations property: The regions in which to deploy the resources needed for Teams + * Calling. + * + * @param serviceLocations The regions in which to deploy the resources needed for Teams Calling. + * @return the next definition stage. + */ + WithCreate withServiceLocations(List serviceLocations); + } + /** The stage of the CommunicationsGateway definition allowing to specify connectivity. */ + interface WithConnectivity { + /** + * Specifies the connectivity property: How to connect back to the operator network, e.g. MAPS. + * + * @param connectivity How to connect back to the operator network, e.g. MAPS. + * @return the next definition stage. + */ + WithCreate withConnectivity(Connectivity connectivity); + } + /** The stage of the CommunicationsGateway definition allowing to specify codecs. */ + interface WithCodecs { + /** + * Specifies the codecs property: Voice codecs to support. + * + * @param codecs Voice codecs to support. + * @return the next definition stage. + */ + WithCreate withCodecs(List codecs); + } + /** The stage of the CommunicationsGateway definition allowing to specify e911Type. */ + interface WithE911Type { + /** + * Specifies the e911Type property: How to handle 911 calls. + * + * @param e911Type How to handle 911 calls. + * @return the next definition stage. + */ + WithCreate withE911Type(E911Type e911Type); + } + /** The stage of the CommunicationsGateway definition allowing to specify platforms. */ + interface WithPlatforms { + /** + * Specifies the platforms property: What platforms to support. + * + * @param platforms What platforms to support. + * @return the next definition stage. + */ + WithCreate withPlatforms(List platforms); + } + /** The stage of the CommunicationsGateway definition allowing to specify apiBridge. */ + interface WithApiBridge { + /** + * Specifies the apiBridge property: Details of API bridge functionality, if required. + * + * @param apiBridge Details of API bridge functionality, if required. + * @return the next definition stage. + */ + WithCreate withApiBridge(Object apiBridge); + } + /** The stage of the CommunicationsGateway definition allowing to specify autoGeneratedDomainNameLabelScope. */ + interface WithAutoGeneratedDomainNameLabelScope { + /** + * Specifies the autoGeneratedDomainNameLabelScope property: The scope at which the auto-generated domain + * name can be re-used. + * + * @param autoGeneratedDomainNameLabelScope The scope at which the auto-generated domain name can be + * re-used. + * @return the next definition stage. + */ + WithCreate withAutoGeneratedDomainNameLabelScope( + AutoGeneratedDomainNameLabelScope autoGeneratedDomainNameLabelScope); + } + /** The stage of the CommunicationsGateway definition allowing to specify teamsVoicemailPilotNumber. */ + interface WithTeamsVoicemailPilotNumber { + /** + * Specifies the teamsVoicemailPilotNumber property: This number is used in Teams Phone Mobile scenarios for + * access to the voicemail IVR from the native dialer.. + * + * @param teamsVoicemailPilotNumber This number is used in Teams Phone Mobile scenarios for access to the + * voicemail IVR from the native dialer. + * @return the next definition stage. + */ + WithCreate withTeamsVoicemailPilotNumber(String teamsVoicemailPilotNumber); + } + /** The stage of the CommunicationsGateway definition allowing to specify onPremMcpEnabled. */ + interface WithOnPremMcpEnabled { + /** + * Specifies the onPremMcpEnabled property: Whether an on-premises Mobile Control Point is in use.. + * + * @param onPremMcpEnabled Whether an on-premises Mobile Control Point is in use. + * @return the next definition stage. + */ + WithCreate withOnPremMcpEnabled(Boolean onPremMcpEnabled); + } + /** The stage of the CommunicationsGateway definition allowing to specify emergencyDialStrings. */ + interface WithEmergencyDialStrings { + /** + * Specifies the emergencyDialStrings property: A list of dial strings used for emergency calling.. + * + * @param emergencyDialStrings A list of dial strings used for emergency calling. + * @return the next definition stage. + */ + WithCreate withEmergencyDialStrings(List emergencyDialStrings); + } + } + /** + * Begins update for the CommunicationsGateway resource. + * + * @return the stage of resource update. + */ + CommunicationsGateway.Update update(); + + /** The template for CommunicationsGateway update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommunicationsGateway apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommunicationsGateway apply(Context context); + } + /** The CommunicationsGateway update stages. */ + interface UpdateStages { + /** The stage of the CommunicationsGateway update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommunicationsGateway refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommunicationsGateway refresh(Context context); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayListResult.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayListResult.java new file mode 100644 index 0000000000000..76b597ba9bff9 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.voiceservices.fluent.models.CommunicationsGatewayInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a CommunicationsGateway list operation. */ +@Fluent +public final class CommunicationsGatewayListResult { + /* + * The CommunicationsGateway items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of CommunicationsGatewayListResult class. */ + public CommunicationsGatewayListResult() { + } + + /** + * Get the value property: The CommunicationsGateway items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CommunicationsGateway items on this page. + * + * @param value the value value to set. + * @return the CommunicationsGatewayListResult object itself. + */ + public CommunicationsGatewayListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CommunicationsGatewayListResult object itself. + */ + public CommunicationsGatewayListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model CommunicationsGatewayListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunicationsGatewayListResult.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayUpdate.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayUpdate.java new file mode 100644 index 0000000000000..a234364894ff5 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGatewayUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the CommunicationsGateway. */ +@Fluent +public final class CommunicationsGatewayUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of CommunicationsGatewayUpdate class. */ + public CommunicationsGatewayUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CommunicationsGatewayUpdate object itself. + */ + public CommunicationsGatewayUpdate 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/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateways.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateways.java new file mode 100644 index 0000000000000..c73a2d51067f6 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsGateways.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CommunicationsGateways. */ +public interface CommunicationsGateways { + /** + * List CommunicationsGateway resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List CommunicationsGateway resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunicationsGateway resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunicationsGateway list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationsGatewayName, Context context); + + /** + * Get a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 CommunicationsGateway. + */ + CommunicationsGateway getByResourceGroup(String resourceGroupName, String communicationsGatewayName); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 communicationsGatewayName); + + /** + * Delete a CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @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 communicationsGatewayName, Context context); + + /** + * Get a CommunicationsGateway. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway along with {@link Response}. + */ + CommunicationsGateway getById(String id); + + /** + * Get a CommunicationsGateway. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunicationsGateway along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CommunicationsGateway. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a CommunicationsGateway. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommunicationsGateway resource. + * + * @param name resource name. + * @return the first stage of the new CommunicationsGateway definition. + */ + CommunicationsGateway.DefinitionStages.Blank define(String name); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsPlatform.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsPlatform.java new file mode 100644 index 0000000000000..c8244dfd4d483 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/CommunicationsPlatform.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Available platform types. */ +public final class CommunicationsPlatform extends ExpandableStringEnum { + /** Static value OperatorConnect for CommunicationsPlatform. */ + public static final CommunicationsPlatform OPERATOR_CONNECT = fromString("OperatorConnect"); + + /** Static value TeamsPhoneMobile for CommunicationsPlatform. */ + public static final CommunicationsPlatform TEAMS_PHONE_MOBILE = fromString("TeamsPhoneMobile"); + + /** + * Creates a new instance of CommunicationsPlatform value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CommunicationsPlatform() { + } + + /** + * Creates or finds a CommunicationsPlatform from its string representation. + * + * @param name a name to look for. + * @return the corresponding CommunicationsPlatform. + */ + @JsonCreator + public static CommunicationsPlatform fromString(String name) { + return fromString(name, CommunicationsPlatform.class); + } + + /** + * Gets known CommunicationsPlatform values. + * + * @return known CommunicationsPlatform values. + */ + public static Collection values() { + return values(CommunicationsPlatform.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Connectivity.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Connectivity.java new file mode 100644 index 0000000000000..f30aac3d2ad83 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Connectivity.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** How this deployment connects back to the operator network. */ +public final class Connectivity extends ExpandableStringEnum { + /** Static value PublicAddress for Connectivity. */ + public static final Connectivity PUBLIC_ADDRESS = fromString("PublicAddress"); + + /** + * Creates a new instance of Connectivity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Connectivity() { + } + + /** + * Creates or finds a Connectivity from its string representation. + * + * @param name a name to look for. + * @return the corresponding Connectivity. + */ + @JsonCreator + public static Connectivity fromString(String name) { + return fromString(name, Connectivity.class); + } + + /** + * Gets known Connectivity values. + * + * @return known Connectivity values. + */ + public static Collection values() { + return values(Connectivity.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/E911Type.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/E911Type.java new file mode 100644 index 0000000000000..ac9822d2786c1 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/E911Type.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The method for terminating emergency calls to the PSTN. */ +public final class E911Type extends ExpandableStringEnum { + /** Static value Standard for E911Type. */ + public static final E911Type STANDARD = fromString("Standard"); + + /** Static value DirectToEsrp for E911Type. */ + public static final E911Type DIRECT_TO_ESRP = fromString("DirectToEsrp"); + + /** + * Creates a new instance of E911Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public E911Type() { + } + + /** + * Creates or finds a E911Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding E911Type. + */ + @JsonCreator + public static E911Type fromString(String name) { + return fromString(name, E911Type.class); + } + + /** + * Gets known E911Type values. + * + * @return known E911Type values. + */ + public static Collection values() { + return values(E911Type.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/NameAvailabilities.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/NameAvailabilities.java new file mode 100644 index 0000000000000..60dd0bf5d04e8 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/NameAvailabilities.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.voiceservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of NameAvailabilities. */ +public interface NameAvailabilities { + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result along with {@link Response}. + */ + Response checkLocalWithResponse( + String location, CheckNameAvailabilityRequest body, Context context); + + /** + * Check whether the resource name is available in the given region. + * + * @param location The location in which uniqueness will be verified. + * @param body The check availability request body. + * @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 check availability result. + */ + CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Operation.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Operation.java new file mode 100644 index 0000000000000..6cdb169f5127d --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/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.voiceservices.models; + +import com.azure.resourcemanager.voiceservices.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.voiceservices.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/OperationDisplay.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/OperationDisplay.java new file mode 100644 index 0000000000000..af3d3a69f90c5 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/OperationListResult.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/OperationListResult.java new file mode 100644 index 0000000000000..40284dae7fe6b --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/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.voiceservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.voiceservices.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Operations.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Operations.java new file mode 100644 index 0000000000000..958784b397261 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Origin.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Origin.java new file mode 100644 index 0000000000000..f64ebb13b06fb --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/PrimaryRegionProperties.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/PrimaryRegionProperties.java new file mode 100644 index 0000000000000..08a8dc0b4fcd9 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/PrimaryRegionProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration used in this region as primary, and other regions as backup. */ +@Fluent +public final class PrimaryRegionProperties { + /* + * IP address to use to contact the operator network from this region + */ + @JsonProperty(value = "operatorAddresses", required = true) + private List operatorAddresses; + + /* + * IP address to use to contact the ESRP from this region + */ + @JsonProperty(value = "esrpAddresses") + private List esrpAddresses; + + /* + * The allowed source IP address or CIDR ranges for signaling + */ + @JsonProperty(value = "allowedSignalingSourceAddressPrefixes") + private List allowedSignalingSourceAddressPrefixes; + + /* + * The allowed source IP address or CIDR ranges for media + */ + @JsonProperty(value = "allowedMediaSourceAddressPrefixes") + private List allowedMediaSourceAddressPrefixes; + + /** Creates an instance of PrimaryRegionProperties class. */ + public PrimaryRegionProperties() { + } + + /** + * Get the operatorAddresses property: IP address to use to contact the operator network from this region. + * + * @return the operatorAddresses value. + */ + public List operatorAddresses() { + return this.operatorAddresses; + } + + /** + * Set the operatorAddresses property: IP address to use to contact the operator network from this region. + * + * @param operatorAddresses the operatorAddresses value to set. + * @return the PrimaryRegionProperties object itself. + */ + public PrimaryRegionProperties withOperatorAddresses(List operatorAddresses) { + this.operatorAddresses = operatorAddresses; + return this; + } + + /** + * Get the esrpAddresses property: IP address to use to contact the ESRP from this region. + * + * @return the esrpAddresses value. + */ + public List esrpAddresses() { + return this.esrpAddresses; + } + + /** + * Set the esrpAddresses property: IP address to use to contact the ESRP from this region. + * + * @param esrpAddresses the esrpAddresses value to set. + * @return the PrimaryRegionProperties object itself. + */ + public PrimaryRegionProperties withEsrpAddresses(List esrpAddresses) { + this.esrpAddresses = esrpAddresses; + return this; + } + + /** + * Get the allowedSignalingSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for + * signaling. + * + * @return the allowedSignalingSourceAddressPrefixes value. + */ + public List allowedSignalingSourceAddressPrefixes() { + return this.allowedSignalingSourceAddressPrefixes; + } + + /** + * Set the allowedSignalingSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for + * signaling. + * + * @param allowedSignalingSourceAddressPrefixes the allowedSignalingSourceAddressPrefixes value to set. + * @return the PrimaryRegionProperties object itself. + */ + public PrimaryRegionProperties withAllowedSignalingSourceAddressPrefixes( + List allowedSignalingSourceAddressPrefixes) { + this.allowedSignalingSourceAddressPrefixes = allowedSignalingSourceAddressPrefixes; + return this; + } + + /** + * Get the allowedMediaSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for media. + * + * @return the allowedMediaSourceAddressPrefixes value. + */ + public List allowedMediaSourceAddressPrefixes() { + return this.allowedMediaSourceAddressPrefixes; + } + + /** + * Set the allowedMediaSourceAddressPrefixes property: The allowed source IP address or CIDR ranges for media. + * + * @param allowedMediaSourceAddressPrefixes the allowedMediaSourceAddressPrefixes value to set. + * @return the PrimaryRegionProperties object itself. + */ + public PrimaryRegionProperties withAllowedMediaSourceAddressPrefixes( + List allowedMediaSourceAddressPrefixes) { + this.allowedMediaSourceAddressPrefixes = allowedMediaSourceAddressPrefixes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operatorAddresses() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operatorAddresses in model PrimaryRegionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrimaryRegionProperties.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ProvisioningState.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ProvisioningState.java new file mode 100644 index 0000000000000..8fdb50bf60989 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ProvisioningState.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning state of the resource. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ServiceRegionProperties.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ServiceRegionProperties.java new file mode 100644 index 0000000000000..31037aabec35a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/ServiceRegionProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The service region configuration needed for Teams Callings. */ +@Fluent +public final class ServiceRegionProperties { + /* + * The name of the region in which the resources needed for Teams Calling will be deployed. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The configuration used in this region as primary, and other regions as backup. + */ + @JsonProperty(value = "primaryRegionProperties", required = true) + private PrimaryRegionProperties primaryRegionProperties; + + /** Creates an instance of ServiceRegionProperties class. */ + public ServiceRegionProperties() { + } + + /** + * Get the name property: The name of the region in which the resources needed for Teams Calling will be deployed. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the region in which the resources needed for Teams Calling will be deployed. + * + * @param name the name value to set. + * @return the ServiceRegionProperties object itself. + */ + public ServiceRegionProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the primaryRegionProperties property: The configuration used in this region as primary, and other regions as + * backup. + * + * @return the primaryRegionProperties value. + */ + public PrimaryRegionProperties primaryRegionProperties() { + return this.primaryRegionProperties; + } + + /** + * Set the primaryRegionProperties property: The configuration used in this region as primary, and other regions as + * backup. + * + * @param primaryRegionProperties the primaryRegionProperties value to set. + * @return the ServiceRegionProperties object itself. + */ + public ServiceRegionProperties withPrimaryRegionProperties(PrimaryRegionProperties primaryRegionProperties) { + this.primaryRegionProperties = primaryRegionProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ServiceRegionProperties")); + } + if (primaryRegionProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property primaryRegionProperties in model ServiceRegionProperties")); + } else { + primaryRegionProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceRegionProperties.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Status.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Status.java new file mode 100644 index 0000000000000..e2db7e4f90fbc --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/Status.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The status of the current CommunicationsGateway resource. */ +public final class Status extends ExpandableStringEnum { + /** Static value ChangePending for Status. */ + public static final Status CHANGE_PENDING = fromString("ChangePending"); + + /** Static value Complete for Status. */ + public static final Status COMPLETE = fromString("Complete"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TeamsCodecs.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TeamsCodecs.java new file mode 100644 index 0000000000000..7417a93c6ec73 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TeamsCodecs.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The voice codecs expected for communication with Teams. */ +public final class TeamsCodecs extends ExpandableStringEnum { + /** Static value PCMA for TeamsCodecs. */ + public static final TeamsCodecs PCMA = fromString("PCMA"); + + /** Static value PCMU for TeamsCodecs. */ + public static final TeamsCodecs PCMU = fromString("PCMU"); + + /** Static value G722 for TeamsCodecs. */ + public static final TeamsCodecs G722 = fromString("G722"); + + /** Static value G722_2 for TeamsCodecs. */ + public static final TeamsCodecs G722_2 = fromString("G722_2"); + + /** Static value SILK_8 for TeamsCodecs. */ + public static final TeamsCodecs SILK_8 = fromString("SILK_8"); + + /** Static value SILK_16 for TeamsCodecs. */ + public static final TeamsCodecs SILK_16 = fromString("SILK_16"); + + /** + * Creates a new instance of TeamsCodecs value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TeamsCodecs() { + } + + /** + * Creates or finds a TeamsCodecs from its string representation. + * + * @param name a name to look for. + * @return the corresponding TeamsCodecs. + */ + @JsonCreator + public static TeamsCodecs fromString(String name) { + return fromString(name, TeamsCodecs.class); + } + + /** + * Gets known TeamsCodecs values. + * + * @return known TeamsCodecs values. + */ + public static Collection values() { + return values(TeamsCodecs.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLine.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLine.java new file mode 100644 index 0000000000000..7dda92fe40089 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLine.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; +import java.util.Map; + +/** An immutable client-side representation of TestLine. */ +public interface TestLine { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the phoneNumber property: The phone number. + * + * @return the phoneNumber value. + */ + String phoneNumber(); + + /** + * Gets the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @return the purpose value. + */ + TestLinePurpose purpose(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner object. + * + * @return the inner object. + */ + TestLineInner innerModel(); + + /** The entirety of the TestLine definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The TestLine definition stages. */ + interface DefinitionStages { + /** The first stage of the TestLine definition. */ + interface Blank extends WithLocation { + } + /** The stage of the TestLine definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the TestLine definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, communicationsGatewayName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @return the next definition stage. + */ + WithCreate withExistingCommunicationsGateway(String resourceGroupName, String communicationsGatewayName); + } + /** + * The stage of the TestLine definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithPhoneNumber, DefinitionStages.WithPurpose { + /** + * Executes the create request. + * + * @return the created resource. + */ + TestLine create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TestLine create(Context context); + } + /** The stage of the TestLine definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the TestLine definition allowing to specify phoneNumber. */ + interface WithPhoneNumber { + /** + * Specifies the phoneNumber property: The phone number. + * + * @param phoneNumber The phone number. + * @return the next definition stage. + */ + WithCreate withPhoneNumber(String phoneNumber); + } + /** The stage of the TestLine definition allowing to specify purpose. */ + interface WithPurpose { + /** + * Specifies the purpose property: Purpose of this test line, e.g. automated or manual testing. + * + * @param purpose Purpose of this test line, e.g. automated or manual testing. + * @return the next definition stage. + */ + WithCreate withPurpose(TestLinePurpose purpose); + } + } + /** + * Begins update for the TestLine resource. + * + * @return the stage of resource update. + */ + TestLine.Update update(); + + /** The template for TestLine update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TestLine apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TestLine apply(Context context); + } + /** The TestLine update stages. */ + interface UpdateStages { + /** The stage of the TestLine update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TestLine refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TestLine refresh(Context context); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineListResult.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineListResult.java new file mode 100644 index 0000000000000..7a8f9af59e8cd --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineListResult.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.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.voiceservices.fluent.models.TestLineInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a TestLine list operation. */ +@Fluent +public final class TestLineListResult { + /* + * The TestLine items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of TestLineListResult class. */ + public TestLineListResult() { + } + + /** + * Get the value property: The TestLine items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The TestLine items on this page. + * + * @param value the value value to set. + * @return the TestLineListResult object itself. + */ + public TestLineListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TestLineListResult object itself. + */ + public TestLineListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model TestLineListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TestLineListResult.class); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLinePurpose.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLinePurpose.java new file mode 100644 index 0000000000000..c69b77182fa8a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLinePurpose.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.voiceservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The purpose of the TestLine resource. */ +public final class TestLinePurpose extends ExpandableStringEnum { + /** Static value Manual for TestLinePurpose. */ + public static final TestLinePurpose MANUAL = fromString("Manual"); + + /** Static value Automated for TestLinePurpose. */ + public static final TestLinePurpose AUTOMATED = fromString("Automated"); + + /** + * Creates a new instance of TestLinePurpose value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TestLinePurpose() { + } + + /** + * Creates or finds a TestLinePurpose from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestLinePurpose. + */ + @JsonCreator + public static TestLinePurpose fromString(String name) { + return fromString(name, TestLinePurpose.class); + } + + /** + * Gets known TestLinePurpose values. + * + * @return known TestLinePurpose values. + */ + public static Collection values() { + return values(TestLinePurpose.class); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineUpdate.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineUpdate.java new file mode 100644 index 0000000000000..f943d400a768d --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLineUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the TestLine. */ +@Fluent +public final class TestLineUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of TestLineUpdate class. */ + public TestLineUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TestLineUpdate object itself. + */ + public TestLineUpdate 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/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLines.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLines.java new file mode 100644 index 0000000000000..0e6c8a76feda9 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/TestLines.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestLines. */ +public interface TestLines { + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCommunicationsGateway(String resourceGroupName, String communicationsGatewayName); + + /** + * List TestLine resources by CommunicationsGateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TestLine list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCommunicationsGateway( + String resourceGroupName, String communicationsGatewayName, Context context); + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String communicationsGatewayName, String testLineName, Context context); + + /** + * Get a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 TestLine. + */ + TestLine get(String resourceGroupName, String communicationsGatewayName, String testLineName); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 communicationsGatewayName, String testLineName); + + /** + * Delete a TestLine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communicationsGatewayName Unique identifier for this deployment. + * @param testLineName Unique identifier for this test line. + * @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 communicationsGatewayName, String testLineName, Context context); + + /** + * Get a TestLine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine along with {@link Response}. + */ + TestLine getById(String id); + + /** + * Get a TestLine. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TestLine along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TestLine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TestLine. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TestLine resource. + * + * @param name resource name. + * @return the first stage of the new TestLine definition. + */ + TestLine.DefinitionStages.Blank define(String name); +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/package-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/package-info.java new file mode 100644 index 0000000000000..1523c0ddd73b9 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MicrosoftVoiceServices. null. */ +package com.azure.resourcemanager.voiceservices.models; diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/package-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/package-info.java new file mode 100644 index 0000000000000..5607e8aeb7ddb --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/com/azure/resourcemanager/voiceservices/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MicrosoftVoiceServices. null. */ +package com.azure.resourcemanager.voiceservices; diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/module-info.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/main/java/module-info.java new file mode 100644 index 0000000000000..de61731a7df81 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/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.voiceservices { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.voiceservices; + exports com.azure.resourcemanager.voiceservices.fluent; + exports com.azure.resourcemanager.voiceservices.fluent.models; + exports com.azure.resourcemanager.voiceservices.models; + + opens com.azure.resourcemanager.voiceservices.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.voiceservices.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysCreateOrUpdateSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9b6dfb0cf0aa0 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +import com.azure.resourcemanager.voiceservices.models.AutoGeneratedDomainNameLabelScope; +import com.azure.resourcemanager.voiceservices.models.CommunicationsPlatform; +import com.azure.resourcemanager.voiceservices.models.Connectivity; +import com.azure.resourcemanager.voiceservices.models.E911Type; +import com.azure.resourcemanager.voiceservices.models.PrimaryRegionProperties; +import com.azure.resourcemanager.voiceservices.models.ServiceRegionProperties; +import com.azure.resourcemanager.voiceservices.models.TeamsCodecs; +import java.util.Arrays; + +/** Samples for CommunicationsGateways CreateOrUpdate. */ +public final class CommunicationsGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_CreateOrUpdate.json + */ + /** + * Sample code: CreateCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void createCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .communicationsGateways() + .define("myname") + .withRegion("useast") + .withExistingResourceGroup("testrg") + .withServiceLocations( + Arrays + .asList( + new ServiceRegionProperties() + .withName("useast") + .withPrimaryRegionProperties( + new PrimaryRegionProperties() + .withOperatorAddresses(Arrays.asList("198.51.100.1")) + .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("10.1.1.0/24")) + .withAllowedMediaSourceAddressPrefixes(Arrays.asList("10.1.2.0/24"))), + new ServiceRegionProperties() + .withName("useast2") + .withPrimaryRegionProperties( + new PrimaryRegionProperties() + .withOperatorAddresses(Arrays.asList("198.51.100.2")) + .withAllowedSignalingSourceAddressPrefixes(Arrays.asList("10.2.1.0/24")) + .withAllowedMediaSourceAddressPrefixes(Arrays.asList("10.2.2.0/24"))))) + .withConnectivity(Connectivity.PUBLIC_ADDRESS) + .withCodecs(Arrays.asList(TeamsCodecs.PCMA)) + .withE911Type(E911Type.STANDARD) + .withPlatforms(Arrays.asList(CommunicationsPlatform.OPERATOR_CONNECT)) + .withAutoGeneratedDomainNameLabelScope(AutoGeneratedDomainNameLabelScope.NO_REUSE) + .withTeamsVoicemailPilotNumber("1234567890") + .create(); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..639f946528ef4 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for CommunicationsGateways Delete. */ +public final class CommunicationsGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Delete.json + */ + /** + * Sample code: DeleteCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void deleteCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().delete("testrg", "myname", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysGetByResourceGroupSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..5d26f12675e17 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for CommunicationsGateways GetByResourceGroup. */ +public final class CommunicationsGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Get.json + */ + /** + * Sample code: GetCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void getCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .communicationsGateways() + .getByResourceGroupWithResponse("testrg", "myname", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListByResourceGroupSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..5d4c394627ef8 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for CommunicationsGateways ListByResourceGroup. */ +public final class CommunicationsGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_ListByResourceGroup.json + */ + /** + * Sample code: ListCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListSamples.java new file mode 100644 index 0000000000000..3eed507347e50 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for CommunicationsGateways List. */ +public final class CommunicationsGatewaysListSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_ListBySubscription.json + */ + /** + * Sample code: ListCommunicationsGatewayResourceSub. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listCommunicationsGatewayResourceSub( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.communicationsGateways().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysUpdateSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysUpdateSamples.java new file mode 100644 index 0000000000000..0bc1c669d42fb --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/CommunicationsGatewaysUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +import com.azure.resourcemanager.voiceservices.models.CommunicationsGateway; + +/** Samples for CommunicationsGateways Update. */ +public final class CommunicationsGatewaysUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/CommunicationsGateways_Update.json + */ + /** + * Sample code: UpdateCommunicationsGatewayResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void updateCommunicationsGatewayResource( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + CommunicationsGateway resource = + manager + .communicationsGateways() + .getByResourceGroupWithResponse("testrg", "myname", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.java new file mode 100644 index 0000000000000..b9406ea568e75 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/NameAvailabilityCheckLocalSamples.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.voiceservices.generated; + +import com.azure.resourcemanager.voiceservices.models.CheckNameAvailabilityRequest; + +/** Samples for NameAvailability CheckLocal. */ +public final class NameAvailabilityCheckLocalSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/NameAvailability_CheckLocal.json + */ + /** + * Sample code: CheckLocalNameAvailability. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void checkLocalNameAvailability( + com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .nameAvailabilities() + .checkLocalWithResponse( + "useast", + new CheckNameAvailabilityRequest() + .withName("myname") + .withType("Microsoft.VoiceServices/CommunicationsGateway"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/OperationsListSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..417272f7fd223 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/Operations_List.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void operationsList(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c04cf1591c252 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +import com.azure.resourcemanager.voiceservices.models.TestLinePurpose; + +/** Samples for TestLines CreateOrUpdate. */ +public final class TestLinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_CreateOrUpdate.json + */ + /** + * Sample code: CreateTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void createTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager + .testLines() + .define("myline") + .withRegion("useast") + .withExistingCommunicationsGateway("testrg", "myname") + .withPhoneNumber("+1-555-1234") + .withPurpose(TestLinePurpose.AUTOMATED) + .create(); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteSamples.java new file mode 100644 index 0000000000000..583da0c3196bd --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for TestLines Delete. */ +public final class TestLinesDeleteSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Delete.json + */ + /** + * Sample code: DeleteTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void deleteTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().delete("testrg", "myname", "myline", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetSamples.java new file mode 100644 index 0000000000000..b3eb8d2db0c8a --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for TestLines Get. */ +public final class TestLinesGetSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Get.json + */ + /** + * Sample code: GetTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void getTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().getWithResponse("testrg", "myname", "myline", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewaySamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewaySamples.java new file mode 100644 index 0000000000000..fff59f60a338b --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesListByCommunicationsGatewaySamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +/** Samples for TestLines ListByCommunicationsGateway. */ +public final class TestLinesListByCommunicationsGatewaySamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_ListByCommunicationsGateway.json + */ + /** + * Sample code: ListTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void listTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + manager.testLines().listByCommunicationsGateway("testrg", "myname", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesUpdateSamples.java b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesUpdateSamples.java new file mode 100644 index 0000000000000..4c99412516fa0 --- /dev/null +++ b/sdk/voiceservices/azure-resourcemanager-voiceservices/src/samples/java/com/azure/resourcemanager/voiceservices/generated/TestLinesUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.voiceservices.generated; + +import com.azure.resourcemanager.voiceservices.models.TestLine; + +/** Samples for TestLines Update. */ +public final class TestLinesUpdateSamples { + /* + * x-ms-original-file: specification/voiceservices/resource-manager/Microsoft.VoiceServices/stable/2023-01-31/examples/TestLines_Update.json + */ + /** + * Sample code: UpdateTestLineResource. + * + * @param manager Entry point to VoiceservicesManager. + */ + public static void updateTestLineResource(com.azure.resourcemanager.voiceservices.VoiceservicesManager manager) { + TestLine resource = + manager + .testLines() + .getWithResponse("testrg", "myname", "myline", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/voiceservices/ci.yml b/sdk/voiceservices/ci.yml new file mode 100644 index 0000000000000..fb7ec35804f8c --- /dev/null +++ b/sdk/voiceservices/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.yml + - sdk/voiceservices/azure-resourcemanager-voiceservices/ + exclude: + - sdk/voiceservices/pom.xml + - sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.yml + - sdk/voiceservices/azure-resourcemanager-voiceservices/ + exclude: + - sdk/voiceservices/pom.xml + - sdk/voiceservices/azure-resourcemanager-voiceservices/pom.xml + +parameters: + - name: release_azureresourcemanagervoiceservices + displayName: azure-resourcemanager-voiceservices + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: voiceservices + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-voiceservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagervoiceservices + releaseInBatch: ${{ parameters.release_azureresourcemanagervoiceservices }} diff --git a/sdk/voiceservices/pom.xml b/sdk/voiceservices/pom.xml new file mode 100644 index 0000000000000..53f488a9caf6b --- /dev/null +++ b/sdk/voiceservices/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-voiceservices-service + pom + 1.0.0 + + + azure-resourcemanager-voiceservices + +