From 125e25be232959e84c58d862153223a53bd680da Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 26 Aug 2021 02:59:47 +0000 Subject: [PATCH] CodeGen from PR 15777 in Azure/azure-rest-api-specs Merge 290d62acf84f4bada1fd885df696b904ba8eacf4 into c5437ef322abbc67b5176425aba31056997b8451 --- .../CHANGELOG.md | 3 +- .../README.md | 4 +- .../pom.xml | 141 +++++----- .../communication/CommunicationManager.java | 36 +-- .../CommunicationServiceManagementClient.java | 7 - .../fluent/OperationStatusesClient.java | 41 --- .../CommunicationServiceResourceInner.java | 41 ++- .../fluent/models/OperationInner.java | 2 +- .../fluent/models/OperationStatusInner.java | 130 ---------- ...municationServiceManagementClientImpl.java | 14 - .../CommunicationServiceResourceImpl.java | 181 ++++++++++++- .../CommunicationServicesImpl.java | 157 ++++++----- .../implementation/OperationStatusImpl.java | 55 ---- .../OperationStatusesClientImpl.java | 194 -------------- .../implementation/OperationStatusesImpl.java | 60 ----- .../models/CommunicationServiceResource.java | 243 +++++++++++++++++- .../models/CommunicationServices.java | 123 ++++----- .../communication/models/OperationStatus.java | 61 ----- .../models/OperationStatuses.java | 36 --- .../communication/models/Status.java | 46 ---- .../communication/models/TaggedResource.java | 2 + 21 files changed, 693 insertions(+), 884 deletions(-) delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java delete mode 100644 sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java diff --git a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md index 865a0ddf5a763..b5bf26965e473 100644 --- a/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md +++ b/sdk/communication/azure-resourcemanager-communication/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2021-08-26) +- Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2020-08-20. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0 (2021-04-08) diff --git a/sdk/communication/azure-resourcemanager-communication/README.md b/sdk/communication/azure-resourcemanager-communication/README.md index 5b487b8cf2b64..bc256e1465a9d 100644 --- a/sdk/communication/azure-resourcemanager-communication/README.md +++ b/sdk/communication/azure-resourcemanager-communication/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-communication - 1.0.0 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,8 @@ See [API design][design] for general introduction on design and key concepts on ## Examples + + ## Troubleshooting ## Next steps diff --git a/sdk/communication/azure-resourcemanager-communication/pom.xml b/sdk/communication/azure-resourcemanager-communication/pom.xml index afc8f153e7275..4be458e5aa150 100644 --- a/sdk/communication/azure-resourcemanager-communication/pom.xml +++ b/sdk/communication/azure-resourcemanager-communication/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-communication - 1.1.0-beta.1 - jar + com.azure.resourcemanager + azure-resourcemanager-communication + 1.1.0-beta.1 + jar - Microsoft Azure SDK for Communication Management - This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2020-08-20. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for Communication Management + This package contains Microsoft Azure SDK for Communication Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure Communication Services. Package tag package-2020-08-20. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core - 1.19.0 - - - com.azure - azure-core-management - 1.4.0 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.5 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.19.0 + + + com.azure + azure-core-management + 1.4.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java index cb69cfdf762f8..6550eb4e5c504 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/CommunicationManager.java @@ -9,7 +9,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,16 +16,15 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.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.communication.fluent.CommunicationServiceManagementClient; import com.azure.resourcemanager.communication.implementation.CommunicationServiceManagementClientBuilder; import com.azure.resourcemanager.communication.implementation.CommunicationServicesImpl; -import com.azure.resourcemanager.communication.implementation.OperationStatusesImpl; import com.azure.resourcemanager.communication.implementation.OperationsImpl; import com.azure.resourcemanager.communication.models.CommunicationServices; -import com.azure.resourcemanager.communication.models.OperationStatuses; import com.azure.resourcemanager.communication.models.Operations; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -40,8 +38,6 @@ public final class CommunicationManager { private CommunicationServices communicationServices; - private OperationStatuses operationStatuses; - private final CommunicationServiceManagementClient clientObject; private CommunicationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -85,6 +81,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -124,6 +121,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { 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. * @@ -166,7 +174,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.communication") .append("/") - .append("1.0.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -180,6 +188,9 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -189,10 +200,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); @@ -221,14 +229,6 @@ public CommunicationServices communicationServices() { return communicationServices; } - /** @return Resource collection API of OperationStatuses. */ - public OperationStatuses operationStatuses() { - if (this.operationStatuses == null) { - this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); - } - return operationStatuses; - } - /** * @return Wrapped service client CommunicationServiceManagementClient providing direct access to the underlying * auto-generated API implementation, based on Azure REST API. diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java index d7f2dd2cc2104..54c4fad491ac4 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/CommunicationServiceManagementClient.java @@ -57,11 +57,4 @@ public interface CommunicationServiceManagementClient { * @return the CommunicationServicesClient object. */ CommunicationServicesClient getCommunicationServices(); - - /** - * Gets the OperationStatusesClient object to access its operations. - * - * @return the OperationStatusesClient object. - */ - OperationStatusesClient getOperationStatuses(); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java deleted file mode 100644 index 4ecd617ef8b4e..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/OperationStatusesClient.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; - -/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ -public interface OperationStatusesClient { - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - OperationStatusInner get(String location, String operationId); - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String location, String operationId, Context context); -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java index 9dce087006ba3..944737a4d86a8 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/CommunicationServiceResourceInner.java @@ -6,18 +6,19 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.communication.models.LocationResource; import com.azure.resourcemanager.communication.models.ProvisioningState; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** A class representing a CommunicationService resource. */ @JsonFlatten @Fluent -public class CommunicationServiceResourceInner extends LocationResource { +public class CommunicationServiceResourceInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(CommunicationServiceResourceInner.class); /* @@ -63,11 +64,18 @@ public class CommunicationServiceResourceInner extends LocationResource { @JsonProperty(value = "properties.immutableResourceId", access = JsonProperty.Access.WRITE_ONLY) private String immutableResourceId; + /* + * The Azure location where the CommunicationService is running. + */ + @JsonProperty(value = "location") + private String location; + /* * Tags of the service which is a list of key value pairs that describe the * resource. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** @@ -145,6 +153,26 @@ public String immutableResourceId() { return this.immutableResourceId; } + /** + * Get the location property: The Azure location where the CommunicationService is running. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure location where the CommunicationService is running. + * + * @param location the location value to set. + * @return the CommunicationServiceResourceInner object itself. + */ + public CommunicationServiceResourceInner withLocation(String location) { + this.location = location; + return this; + } + /** * Get the tags property: Tags of the service which is a list of key value pairs that describe the resource. * @@ -165,20 +193,11 @@ public CommunicationServiceResourceInner withTags(Map tags) { return this; } - /** {@inheritDoc} */ - @Override - public CommunicationServiceResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ - @Override public void validate() { - super.validate(); } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java index bdaf3f4e3c855..2db5f3a5eca77 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationInner.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -/** Details of a REST API operation, returned from the Resource Provider Operations API. */ +/** REST API Operation Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent public final class OperationInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java deleted file mode 100644 index 2f88d5d594bef..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/fluent/models/OperationStatusInner.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.communication.models.Status; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** The current status of an async operation. */ -@JsonFlatten -@Fluent -public class OperationStatusInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusInner.class); - - /* - * Fully qualified ID for the operation status. - */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) - private String id; - - /* - * Provisioning state of the resource. - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private Status status; - - /* - * The start time of the operation - */ - @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime startTime; - - /* - * The end time of the operation - */ - @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime endTime; - - /* - * Percent of the operation that is complete - */ - @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) - private Float percentComplete; - - /* - * The error object. - */ - @JsonProperty(value = "error.error") - private ManagementError error; - - /** - * Get the id property: Fully qualified ID for the operation status. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Get the status property: Provisioning state of the resource. - * - * @return the status value. - */ - public Status status() { - return this.status; - } - - /** - * Get the startTime property: The start time of the operation. - * - * @return the startTime value. - */ - public OffsetDateTime startTime() { - return this.startTime; - } - - /** - * Get the endTime property: The end time of the operation. - * - * @return the endTime value. - */ - public OffsetDateTime endTime() { - return this.endTime; - } - - /** - * Get the percentComplete property: Percent of the operation that is complete. - * - * @return the percentComplete value. - */ - public Float percentComplete() { - return this.percentComplete; - } - - /** - * Get the error property: The error object. - * - * @return the error value. - */ - public ManagementError error() { - return this.error; - } - - /** - * Set the error property: The error object. - * - * @param error the error value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withError(ManagementError error) { - this.error = error; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java index 4f22d861a9b0d..f39584f6b665f 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceManagementClientImpl.java @@ -23,7 +23,6 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.communication.fluent.CommunicationServiceManagementClient; import com.azure.resourcemanager.communication.fluent.CommunicationServicesClient; -import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; import com.azure.resourcemanager.communication.fluent.OperationsClient; import java.io.IOException; import java.lang.reflect.Type; @@ -136,18 +135,6 @@ public CommunicationServicesClient getCommunicationServices() { return this.communicationServices; } - /** The OperationStatusesClient object to access its operations. */ - private final OperationStatusesClient operationStatuses; - - /** - * Gets the OperationStatusesClient object to access its operations. - * - * @return the OperationStatusesClient object. - */ - public OperationStatusesClient getOperationStatuses() { - return this.operationStatuses; - } - /** * Initializes an instance of CommunicationServiceManagementClient client. * @@ -173,7 +160,6 @@ public OperationStatusesClient getOperationStatuses() { this.apiVersion = "2020-08-20"; this.operations = new OperationsClientImpl(this); this.communicationServices = new CommunicationServicesClientImpl(this); - this.operationStatuses = new OperationStatusesClientImpl(this); } /** diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java index 563579c206258..c8b9ac24d3ebe 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServiceResourceImpl.java @@ -4,27 +4,38 @@ package com.azure.resourcemanager.communication.implementation; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; +import com.azure.resourcemanager.communication.models.CommunicationServiceKeys; import com.azure.resourcemanager.communication.models.CommunicationServiceResource; +import com.azure.resourcemanager.communication.models.LinkNotificationHubParameters; +import com.azure.resourcemanager.communication.models.LinkedNotificationHub; import com.azure.resourcemanager.communication.models.ProvisioningState; +import com.azure.resourcemanager.communication.models.RegenerateKeyParameters; import java.util.Collections; import java.util.Map; -public final class CommunicationServiceResourceImpl implements CommunicationServiceResource { +public final class CommunicationServiceResourceImpl + implements CommunicationServiceResource, + CommunicationServiceResource.Definition, + CommunicationServiceResource.Update { private CommunicationServiceResourceInner innerObject; private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; - CommunicationServiceResourceImpl( - CommunicationServiceResourceInner innerObject, - com.azure.resourcemanager.communication.CommunicationManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; + public String id() { + return this.innerModel().id(); } - public String location() { - return this.innerModel().location(); + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); } public SystemData systemData() { @@ -55,6 +66,10 @@ public String immutableResourceId() { return this.innerModel().immutableResourceId(); } + public String location() { + return this.innerModel().location(); + } + public Map tags() { Map inner = this.innerModel().tags(); if (inner != null) { @@ -64,6 +79,14 @@ public Map tags() { } } + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + public CommunicationServiceResourceInner innerModel() { return this.innerObject; } @@ -71,4 +94,146 @@ public CommunicationServiceResourceInner innerModel() { private com.azure.resourcemanager.communication.CommunicationManager manager() { return this.serviceManager; } + + private String resourceGroupName; + + private String communicationServiceName; + + public CommunicationServiceResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CommunicationServiceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .createOrUpdate(resourceGroupName, communicationServiceName, this.innerModel(), Context.NONE); + return this; + } + + public CommunicationServiceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .createOrUpdate(resourceGroupName, communicationServiceName, this.innerModel(), context); + return this; + } + + CommunicationServiceResourceImpl( + String name, com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = new CommunicationServiceResourceInner(); + this.serviceManager = serviceManager; + this.communicationServiceName = name; + } + + public CommunicationServiceResourceImpl update() { + return this; + } + + public CommunicationServiceResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .updateWithResponse(resourceGroupName, communicationServiceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CommunicationServiceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .updateWithResponse(resourceGroupName, communicationServiceName, this.innerModel(), context) + .getValue(); + return this; + } + + CommunicationServiceResourceImpl( + CommunicationServiceResourceInner innerObject, + com.azure.resourcemanager.communication.CommunicationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communicationServiceName = Utils.getValueFromIdByName(innerObject.id(), "communicationServices"); + } + + public CommunicationServiceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .getByResourceGroupWithResponse(resourceGroupName, communicationServiceName, Context.NONE) + .getValue(); + return this; + } + + public CommunicationServiceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCommunicationServices() + .getByResourceGroupWithResponse(resourceGroupName, communicationServiceName, context) + .getValue(); + return this; + } + + public LinkedNotificationHub linkNotificationHub() { + return serviceManager.communicationServices().linkNotificationHub(resourceGroupName, communicationServiceName); + } + + public Response linkNotificationHubWithResponse( + LinkNotificationHubParameters linkNotificationHubParameters, Context context) { + return serviceManager + .communicationServices() + .linkNotificationHubWithResponse( + resourceGroupName, communicationServiceName, linkNotificationHubParameters, context); + } + + public CommunicationServiceKeys listKeys() { + return serviceManager.communicationServices().listKeys(resourceGroupName, communicationServiceName); + } + + public Response listKeysWithResponse(Context context) { + return serviceManager + .communicationServices() + .listKeysWithResponse(resourceGroupName, communicationServiceName, context); + } + + public CommunicationServiceKeys regenerateKey(RegenerateKeyParameters parameters) { + return serviceManager + .communicationServices() + .regenerateKey(resourceGroupName, communicationServiceName, parameters); + } + + public Response regenerateKeyWithResponse( + RegenerateKeyParameters parameters, Context context) { + return serviceManager + .communicationServices() + .regenerateKeyWithResponse(resourceGroupName, communicationServiceName, parameters, context); + } + + public CommunicationServiceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CommunicationServiceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CommunicationServiceResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public CommunicationServiceResourceImpl withDataLocation(String dataLocation) { + this.innerModel().withDataLocation(dataLocation); + return this; + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java index e0e7e93a92a16..fbbb30cc0368e 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/CommunicationServicesImpl.java @@ -115,34 +115,6 @@ public PagedIterable listByResourceGroup(String re return Utils.mapPage(inner, inner1 -> new CommunicationServiceResourceImpl(inner1, this.manager())); } - public CommunicationServiceResource update(String resourceGroupName, String communicationServiceName) { - CommunicationServiceResourceInner inner = - this.serviceClient().update(resourceGroupName, communicationServiceName); - if (inner != null) { - return new CommunicationServiceResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response updateWithResponse( - String resourceGroupName, - String communicationServiceName, - CommunicationServiceResourceInner parameters, - Context context) { - Response inner = - this.serviceClient().updateWithResponse(resourceGroupName, communicationServiceName, parameters, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new CommunicationServiceResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - public CommunicationServiceResource getByResourceGroup(String resourceGroupName, String communicationServiceName) { CommunicationServiceResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, communicationServiceName); @@ -168,41 +140,6 @@ public Response getByResourceGroupWithResponse( } } - public CommunicationServiceResource createOrUpdate( - String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters) { - CommunicationServiceResourceInner inner = - this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName, parameters); - if (inner != null) { - return new CommunicationServiceResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public CommunicationServiceResource createOrUpdate(String resourceGroupName, String communicationServiceName) { - CommunicationServiceResourceInner inner = - this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName); - if (inner != null) { - return new CommunicationServiceResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public CommunicationServiceResource createOrUpdate( - String resourceGroupName, - String communicationServiceName, - CommunicationServiceResourceInner parameters, - Context context) { - CommunicationServiceResourceInner inner = - this.serviceClient().createOrUpdate(resourceGroupName, communicationServiceName, parameters, context); - if (inner != null) { - return new CommunicationServiceResourceImpl(inner, this.manager()); - } else { - return null; - } - } - public void deleteByResourceGroup(String resourceGroupName, String communicationServiceName) { this.serviceClient().delete(resourceGroupName, communicationServiceName); } @@ -267,6 +204,96 @@ public Response regenerateKeyWithResponse( } } + public CommunicationServiceResource 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 communicationServiceName = Utils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, communicationServiceName, 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 communicationServiceName = Utils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communicationServiceName, 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 communicationServiceName = Utils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", + id))); + } + this.delete(resourceGroupName, communicationServiceName, 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 communicationServiceName = Utils.getValueFromIdByName(id, "communicationServices"); + if (communicationServiceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationServices'.", + id))); + } + this.delete(resourceGroupName, communicationServiceName, context); + } + private CommunicationServicesClient serviceClient() { return this.innerClient; } @@ -274,4 +301,8 @@ private CommunicationServicesClient serviceClient() { private com.azure.resourcemanager.communication.CommunicationManager manager() { return this.serviceManager; } + + public CommunicationServiceResourceImpl define(String name) { + return new CommunicationServiceResourceImpl(name, this.manager()); + } } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java deleted file mode 100644 index 607f8cc500ca8..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.implementation; - -import com.azure.core.management.exception.ManagementError; -import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; -import com.azure.resourcemanager.communication.models.OperationStatus; -import com.azure.resourcemanager.communication.models.Status; -import java.time.OffsetDateTime; - -public final class OperationStatusImpl implements OperationStatus { - private OperationStatusInner innerObject; - - private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; - - OperationStatusImpl( - OperationStatusInner innerObject, com.azure.resourcemanager.communication.CommunicationManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public Status status() { - return this.innerModel().status(); - } - - public OffsetDateTime startTime() { - return this.innerModel().startTime(); - } - - public OffsetDateTime endTime() { - return this.innerModel().endTime(); - } - - public Float percentComplete() { - return this.innerModel().percentComplete(); - } - - public ManagementError error() { - return this.innerModel().error(); - } - - public OperationStatusInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.communication.CommunicationManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java deleted file mode 100644 index cc74df4c16722..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesClientImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; -import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in OperationStatusesClient. */ -public final class OperationStatusesClientImpl implements OperationStatusesClient { - private final ClientLogger logger = new ClientLogger(OperationStatusesClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final OperationStatusesService service; - - /** The service client containing this operation class. */ - private final CommunicationServiceManagementClientImpl client; - - /** - * Initializes an instance of OperationStatusesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationStatusesClientImpl(CommunicationServiceManagementClientImpl client) { - this.service = - RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CommunicationServiceManagementClientOperationStatuses to be used by - * the proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "CommunicationService") - private interface OperationStatusesService { - @Headers({"Content-Type: application/json"}) - @Get("/providers/Microsoft.Communication/locations/{location}/operationStatuses/{operationId}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("location") String location, - @PathParam("operationId") String operationId, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String location, String operationId) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (location == null) { - return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); - } - if (operationId == null) { - return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .get( - this.client.getEndpoint(), - this.client.getApiVersion(), - location, - operationId, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync( - String location, String operationId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (location == null) { - return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); - } - if (operationId == null) { - return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .get(this.client.getEndpoint(), this.client.getApiVersion(), location, operationId, accept, context); - } - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String location, String operationId) { - return getWithResponseAsync(location, operationId) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public OperationStatusInner get(String location, String operationId) { - return getAsync(location, operationId).block(); - } - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String location, String operationId, Context context) { - return getWithResponseAsync(location, operationId, context).block(); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java deleted file mode 100644 index 1004978d4dffc..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationStatusesImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.communication.fluent.OperationStatusesClient; -import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; -import com.azure.resourcemanager.communication.models.OperationStatus; -import com.azure.resourcemanager.communication.models.OperationStatuses; -import com.fasterxml.jackson.annotation.JsonIgnore; - -public final class OperationStatusesImpl implements OperationStatuses { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusesImpl.class); - - private final OperationStatusesClient innerClient; - - private final com.azure.resourcemanager.communication.CommunicationManager serviceManager; - - public OperationStatusesImpl( - OperationStatusesClient innerClient, - com.azure.resourcemanager.communication.CommunicationManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public OperationStatus get(String location, String operationId) { - OperationStatusInner inner = this.serviceClient().get(location, operationId); - if (inner != null) { - return new OperationStatusImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response getWithResponse(String location, String operationId, Context context) { - Response inner = this.serviceClient().getWithResponse(location, operationId, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new OperationStatusImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - private OperationStatusesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.communication.CommunicationManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java index 1419d211f2070..74c79602c3a48 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServiceResource.java @@ -4,18 +4,35 @@ package com.azure.resourcemanager.communication.models; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; import java.util.Map; /** An immutable client-side representation of CommunicationServiceResource. */ public interface CommunicationServiceResource { /** - * Gets the location property: The Azure location where the CommunicationService is running. + * Gets the id property: Fully qualified resource Id for the resource. * - * @return the location value. + * @return the id value. */ - String location(); + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); /** * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. @@ -67,6 +84,13 @@ public interface CommunicationServiceResource { */ String immutableResourceId(); + /** + * Gets the location property: The Azure location where the CommunicationService is running. + * + * @return the location value. + */ + String location(); + /** * Gets the tags property: Tags of the service which is a list of key value pairs that describe the resource. * @@ -74,10 +98,223 @@ public interface CommunicationServiceResource { */ Map tags(); + /** + * 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 inner com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner object. * * @return the inner object. */ CommunicationServiceResourceInner innerModel(); + + /** The entirety of the CommunicationServiceResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The CommunicationServiceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the CommunicationServiceResource definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the CommunicationServiceResource 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 CommunicationServiceResource 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.WithLocation, DefinitionStages.WithTags, DefinitionStages.WithDataLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommunicationServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommunicationServiceResource create(Context context); + } + /** The stage of the CommunicationServiceResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The Azure location where the CommunicationService is running. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The Azure location where the CommunicationService is running. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the CommunicationServiceResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags of the service which is a list of key value pairs that describe the + * resource.. + * + * @param tags Tags of the service which is a list of key value pairs that describe the resource. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CommunicationServiceResource definition allowing to specify dataLocation. */ + interface WithDataLocation { + /** + * Specifies the dataLocation property: The location where the communication service stores its data at + * rest.. + * + * @param dataLocation The location where the communication service stores its data at rest. + * @return the next definition stage. + */ + WithCreate withDataLocation(String dataLocation); + } + } + /** + * Begins update for the CommunicationServiceResource resource. + * + * @return the stage of resource update. + */ + CommunicationServiceResource.Update update(); + + /** The template for CommunicationServiceResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommunicationServiceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommunicationServiceResource apply(Context context); + } + /** The CommunicationServiceResource update stages. */ + interface UpdateStages { + /** The stage of the CommunicationServiceResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags of the service which is a list of key value pairs that describe the + * resource.. + * + * @param tags Tags of the service which is a list of key value pairs that describe the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommunicationServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommunicationServiceResource refresh(Context context); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification hub that has been linked to the communication service. + */ + LinkedNotificationHub linkNotificationHub(); + + /** + * Links an Azure Notification Hub to this communication service. + * + * @param linkNotificationHubParameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification hub that has been linked to the communication service. + */ + Response linkNotificationHubWithResponse( + LinkNotificationHubParameters linkNotificationHubParameters, Context context); + + /** + * Get the access keys of the CommunicationService resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys of the CommunicationService resource. + */ + CommunicationServiceKeys listKeys(); + + /** + * Get the access keys of the CommunicationService resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the access keys of the CommunicationService resource. + */ + Response listKeysWithResponse(Context context); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param parameters Parameter that describes the Regenerate Key Operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class representing the access keys of a CommunicationService. + */ + CommunicationServiceKeys regenerateKey(RegenerateKeyParameters parameters); + + /** + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param parameters Parameter that describes the Regenerate Key Operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class representing the access keys of a CommunicationService. + */ + Response regenerateKeyWithResponse(RegenerateKeyParameters parameters, Context context); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java index 6485f9cf5edd7..0908a883bad22 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/CommunicationServices.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.communication.fluent.models.CommunicationServiceResourceInner; /** Resource collection API of CommunicationServices. */ public interface CommunicationServices { @@ -107,180 +106,158 @@ Response linkNotificationHubWithResponse( PagedIterable listByResourceGroup(String resourceGroupName, Context context); /** - * Operation to update an existing CommunicationService. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a class representing a CommunicationService resource. - */ - CommunicationServiceResource update(String resourceGroupName, String communicationServiceName); - - /** - * Operation to update an existing CommunicationService. + * Get the CommunicationService and its properties. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the update operation. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a class representing a CommunicationService resource. + * @return the CommunicationService and its properties. */ - Response updateWithResponse( - String resourceGroupName, - String communicationServiceName, - CommunicationServiceResourceInner parameters, - Context context); + CommunicationServiceResource getByResourceGroup(String resourceGroupName, String communicationServiceName); /** * Get the CommunicationService and its properties. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the CommunicationService and its properties. */ - CommunicationServiceResource getByResourceGroup(String resourceGroupName, String communicationServiceName); + Response getByResourceGroupWithResponse( + String resourceGroupName, String communicationServiceName, Context context); /** - * Get the CommunicationService and its properties. + * Operation to delete a CommunicationService. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the CommunicationService and its properties. */ - Response getByResourceGroupWithResponse( - String resourceGroupName, String communicationServiceName, Context context); + void deleteByResourceGroup(String resourceGroupName, String communicationServiceName); /** - * Create a new CommunicationService or update an existing CommunicationService. + * Operation to delete a CommunicationService. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the create or update operation. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a class representing a CommunicationService resource. */ - CommunicationServiceResource createOrUpdate( - String resourceGroupName, String communicationServiceName, CommunicationServiceResourceInner parameters); + void delete(String resourceGroupName, String communicationServiceName, Context context); /** - * Create a new CommunicationService or update an existing CommunicationService. + * Get the access keys of the CommunicationService resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a class representing a CommunicationService resource. + * @return the access keys of the CommunicationService resource. */ - CommunicationServiceResource createOrUpdate(String resourceGroupName, String communicationServiceName); + CommunicationServiceKeys listKeys(String resourceGroupName, String communicationServiceName); /** - * Create a new CommunicationService or update an existing CommunicationService. + * Get the access keys of the CommunicationService resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameters for the create or update operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a class representing a CommunicationService resource. + * @return the access keys of the CommunicationService resource. */ - CommunicationServiceResource createOrUpdate( - String resourceGroupName, - String communicationServiceName, - CommunicationServiceResourceInner parameters, - Context context); + Response listKeysWithResponse( + String resourceGroupName, String communicationServiceName, Context context); /** - * Operation to delete a CommunicationService. + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class representing the access keys of a CommunicationService. */ - void deleteByResourceGroup(String resourceGroupName, String communicationServiceName); + CommunicationServiceKeys regenerateKey( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters); /** - * Operation to delete a CommunicationService. + * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param communicationServiceName The name of the CommunicationService resource. + * @param parameters Parameter that describes the Regenerate Key Operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a class representing the access keys of a CommunicationService. */ - void delete(String resourceGroupName, String communicationServiceName, Context context); + Response regenerateKeyWithResponse( + String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters, Context context); /** - * Get the access keys of the CommunicationService resource. + * Get the CommunicationService and its properties. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. + * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the access keys of the CommunicationService resource. + * @return the CommunicationService and its properties. */ - CommunicationServiceKeys listKeys(String resourceGroupName, String communicationServiceName); + CommunicationServiceResource getById(String id); /** - * Get the access keys of the CommunicationService resource. + * Get the CommunicationService and its properties. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. + * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the access keys of the CommunicationService resource. + * @return the CommunicationService and its properties. */ - Response listKeysWithResponse( - String resourceGroupName, String communicationServiceName, Context context); + Response getByIdWithResponse(String id, Context context); /** - * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * Operation to delete a CommunicationService. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. */ - CommunicationServiceKeys regenerateKey( - String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters); + void deleteById(String id); /** - * Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * Operation to delete a CommunicationService. * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param communicationServiceName The name of the CommunicationService resource. - * @param parameters Parameter that describes the Regenerate Key Operation. + * @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 class representing the access keys of a CommunicationService. */ - Response regenerateKeyWithResponse( - String resourceGroupName, String communicationServiceName, RegenerateKeyParameters parameters, Context context); + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommunicationServiceResource resource. + * + * @param name resource name. + * @return the first stage of the new CommunicationServiceResource definition. + */ + CommunicationServiceResource.DefinitionStages.Blank define(String name); } diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java deleted file mode 100644 index 907ad01b7b693..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.models; - -import com.azure.core.management.exception.ManagementError; -import com.azure.resourcemanager.communication.fluent.models.OperationStatusInner; -import java.time.OffsetDateTime; - -/** An immutable client-side representation of OperationStatus. */ -public interface OperationStatus { - /** - * Gets the id property: Fully qualified ID for the operation status. - * - * @return the id value. - */ - String id(); - - /** - * Gets the status property: Provisioning state of the resource. - * - * @return the status value. - */ - Status status(); - - /** - * Gets the startTime property: The start time of the operation. - * - * @return the startTime value. - */ - OffsetDateTime startTime(); - - /** - * Gets the endTime property: The end time of the operation. - * - * @return the endTime value. - */ - OffsetDateTime endTime(); - - /** - * Gets the percentComplete property: Percent of the operation that is complete. - * - * @return the percentComplete value. - */ - Float percentComplete(); - - /** - * Gets the error property: The error object. - * - * @return the error value. - */ - ManagementError error(); - - /** - * Gets the inner com.azure.resourcemanager.communication.fluent.models.OperationStatusInner object. - * - * @return the inner object. - */ - OperationStatusInner innerModel(); -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java deleted file mode 100644 index 18424972bb752..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/OperationStatuses.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of OperationStatuses. */ -public interface OperationStatuses { - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - OperationStatus get(String location, String operationId); - - /** - * Gets the current status of an async operation. - * - * @param location The Azure region. - * @param operationId The ID of an ongoing async operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the current status of an async operation. - */ - Response getWithResponse(String location, String operationId, Context context); -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java deleted file mode 100644 index 63b883bb7a993..0000000000000 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/Status.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.communication.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for Status. */ -public final class Status extends ExpandableStringEnum { - /** Static value Succeeded for Status. */ - public static final Status SUCCEEDED = fromString("Succeeded"); - - /** Static value Failed for Status. */ - public static final Status FAILED = fromString("Failed"); - - /** Static value Canceled for Status. */ - public static final Status CANCELED = fromString("Canceled"); - - /** Static value Creating for Status. */ - public static final Status CREATING = fromString("Creating"); - - /** Static value Deleting for Status. */ - public static final Status DELETING = fromString("Deleting"); - - /** Static value Moving for Status. */ - public static final Status MOVING = fromString("Moving"); - - /** - * Creates or finds a Status from its string representation. - * - * @param name a name to look for. - * @return the corresponding Status. - */ - @JsonCreator - public static Status fromString(String name) { - return fromString(name, Status.class); - } - - /** @return known Status values. */ - public static Collection values() { - return values(Status.class); - } -} diff --git a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java index 33324c86b3922..1682e83577276 100644 --- a/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java +++ b/sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/TaggedResource.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -20,6 +21,7 @@ public class TaggedResource { * resource. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /**