diff --git a/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md index 08071a43b46b..6bcddb1c4cf0 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md +++ b/sdk/iothub/azure-resourcemanager-iothub/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-04-28) +- Azure Resource Manager IotHub client library for Java. This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2021-03-02) diff --git a/sdk/iothub/azure-resourcemanager-iothub/README.md b/sdk/iothub/azure-resourcemanager-iothub/README.md index 6bb6bc4963b7..3db611fd41ea 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/README.md +++ b/sdk/iothub/azure-resourcemanager-iothub/README.md @@ -2,7 +2,7 @@ Azure Resource Manager IotHub client library for Java. -This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2020-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2021-03. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-iothub - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/iothub/azure-resourcemanager-iothub/pom.xml b/sdk/iothub/azure-resourcemanager-iothub/pom.xml index 32a7d4424e91..6c9d2584bcea 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/pom.xml +++ b/sdk/iothub/azure-resourcemanager-iothub/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for IotHub Management - This package contains Microsoft Azure SDK for IotHub Management SDK. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-2020-03. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + This package contains Microsoft Azure SDK for IotHub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Use this API to manage the IoT hubs in your Azure subscription. Package tag package-preview-2021-03. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java index caf6815db905..a45e65ac37cd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/IotHubManager.java @@ -209,6 +209,7 @@ public IotHubManager authenticate(TokenCredential credential, AzureProfile profi .add( new BearerTokenAuthenticationPolicy( credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java index 02569754c6ec..bc2ca2a5e211 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/CertificatesClient.java @@ -11,7 +11,6 @@ import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; -import com.azure.resourcemanager.iothub.models.CertificateBodyDescription; import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription; /** An instance of this class provides access to all the operations defined in CertificatesClient. */ @@ -96,7 +95,7 @@ CertificateDescriptionInner createOrUpdate( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription); + CertificateDescriptionInner certificateDescription); /** * Adds new or replaces existing certificate. @@ -119,7 +118,7 @@ Response createOrUpdateWithResponse( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription, + CertificateDescriptionInner certificateDescription, String ifMatch, Context context); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java index 7ac5e999393d..5213c706fc68 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/IotHubResourcesClient.java @@ -22,6 +22,7 @@ import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; import com.azure.resourcemanager.iothub.models.OperationInputs; @@ -476,6 +477,7 @@ Response getEventHubConsumerGroupWithResponse( * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by * server. @@ -484,7 +486,11 @@ Response getEventHubConsumerGroupWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) EventHubConsumerGroupInfoInner createEventHubConsumerGroup( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name); + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody); /** * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -493,6 +499,7 @@ EventHubConsumerGroupInfoInner createEventHubConsumerGroup( * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by @@ -502,7 +509,12 @@ EventHubConsumerGroupInfoInner createEventHubConsumerGroup( */ @ServiceMethod(returns = ReturnType.SINGLE) Response createEventHubConsumerGroupWithResponse( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + Context context); /** * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java index dd0da3aa0fbd..2091a2c740a4 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/EndpointHealthDataInner.java @@ -5,10 +5,12 @@ package com.azure.resourcemanager.iothub.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.DateTimeRfc1123; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.iothub.models.EndpointHealthStatus; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; /** The health data for an endpoint. */ @Fluent @@ -37,6 +39,30 @@ public final class EndpointHealthDataInner { @JsonProperty(value = "healthStatus") private EndpointHealthStatus healthStatus; + /* + * Last error obtained when a message failed to be delivered to iot hub + */ + @JsonProperty(value = "lastKnownError") + private String lastKnownError; + + /* + * Time at which the last known error occurred + */ + @JsonProperty(value = "lastKnownErrorTime") + private DateTimeRfc1123 lastKnownErrorTime; + + /* + * Last time iot hub successfully sent a message to the endpoint + */ + @JsonProperty(value = "lastSuccessfulSendAttemptTime") + private DateTimeRfc1123 lastSuccessfulSendAttemptTime; + + /* + * Last time iot hub tried to send a message to the endpoint + */ + @JsonProperty(value = "lastSendAttemptTime") + private DateTimeRfc1123 lastSendAttemptTime; + /** * Get the endpointId property: Id of the endpoint. * @@ -91,6 +117,107 @@ public EndpointHealthDataInner withHealthStatus(EndpointHealthStatus healthStatu return this; } + /** + * Get the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @return the lastKnownError value. + */ + public String lastKnownError() { + return this.lastKnownError; + } + + /** + * Set the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @param lastKnownError the lastKnownError value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastKnownError(String lastKnownError) { + this.lastKnownError = lastKnownError; + return this; + } + + /** + * Get the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @return the lastKnownErrorTime value. + */ + public OffsetDateTime lastKnownErrorTime() { + if (this.lastKnownErrorTime == null) { + return null; + } + return this.lastKnownErrorTime.getDateTime(); + } + + /** + * Set the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @param lastKnownErrorTime the lastKnownErrorTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastKnownErrorTime(OffsetDateTime lastKnownErrorTime) { + if (lastKnownErrorTime == null) { + this.lastKnownErrorTime = null; + } else { + this.lastKnownErrorTime = new DateTimeRfc1123(lastKnownErrorTime); + } + return this; + } + + /** + * Get the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @return the lastSuccessfulSendAttemptTime value. + */ + public OffsetDateTime lastSuccessfulSendAttemptTime() { + if (this.lastSuccessfulSendAttemptTime == null) { + return null; + } + return this.lastSuccessfulSendAttemptTime.getDateTime(); + } + + /** + * Set the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @param lastSuccessfulSendAttemptTime the lastSuccessfulSendAttemptTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastSuccessfulSendAttemptTime(OffsetDateTime lastSuccessfulSendAttemptTime) { + if (lastSuccessfulSendAttemptTime == null) { + this.lastSuccessfulSendAttemptTime = null; + } else { + this.lastSuccessfulSendAttemptTime = new DateTimeRfc1123(lastSuccessfulSendAttemptTime); + } + return this; + } + + /** + * Get the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @return the lastSendAttemptTime value. + */ + public OffsetDateTime lastSendAttemptTime() { + if (this.lastSendAttemptTime == null) { + return null; + } + return this.lastSendAttemptTime.getDateTime(); + } + + /** + * Set the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @param lastSendAttemptTime the lastSendAttemptTime value to set. + * @return the EndpointHealthDataInner object itself. + */ + public EndpointHealthDataInner withLastSendAttemptTime(OffsetDateTime lastSendAttemptTime) { + if (lastSendAttemptTime == null) { + this.lastSendAttemptTime = null; + } else { + this.lastSendAttemptTime = new DateTimeRfc1123(lastSendAttemptTime); + } + return this; + } + /** * Validates the instance. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java index 4eebe4e0ddf7..6cc25bbe0aac 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/fluent/models/IotHubDescriptionInner.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iothub.models.ArmIdentity; import com.azure.resourcemanager.iothub.models.IotHubProperties; import com.azure.resourcemanager.iothub.models.IotHubSkuInfo; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -38,6 +39,12 @@ public final class IotHubDescriptionInner extends Resource { @JsonProperty(value = "sku", required = true) private IotHubSkuInfo sku; + /* + * The managed identities for the IotHub. + */ + @JsonProperty(value = "identity") + private ArmIdentity identity; + /** * Get the etag property: The Etag field is *not* required. If it is provided in the response body, it must also be * provided as a header per the normal ETag convention. @@ -100,6 +107,26 @@ public IotHubDescriptionInner withSku(IotHubSkuInfo sku) { return this; } + /** + * Get the identity property: The managed identities for the IotHub. + * + * @return the identity value. + */ + public ArmIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identities for the IotHub. + * + * @param identity the identity value to set. + * @return the IotHubDescriptionInner object itself. + */ + public IotHubDescriptionInner withIdentity(ArmIdentity identity) { + this.identity = identity; + return this; + } + /** {@inheritDoc} */ @Override public IotHubDescriptionInner withLocation(String location) { @@ -130,5 +157,8 @@ public void validate() { } else { sku().validate(); } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java index f6fdfbacb4ff..1e2a9b869689 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateDescriptionImpl.java @@ -5,9 +5,7 @@ package com.azure.resourcemanager.iothub.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; -import com.azure.resourcemanager.iothub.models.CertificateBodyDescription; import com.azure.resourcemanager.iothub.models.CertificateDescription; import com.azure.resourcemanager.iothub.models.CertificateProperties; @@ -15,7 +13,7 @@ public final class CertificateDescriptionImpl implements CertificateDescription, CertificateDescription.Definition, CertificateDescription.Update { private CertificateDescriptionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; public String id() { return this.innerModel().id(); @@ -41,7 +39,7 @@ public CertificateDescriptionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } @@ -53,12 +51,8 @@ private IotHubManager manager() { private String createIfMatch; - private CertificateBodyDescription createCertificateDescription; - private String updateIfMatch; - private CertificateBodyDescription updateCertificateDescription; - public CertificateDescriptionImpl withExistingIotHub(String resourceGroupName, String resourceName) { this.resourceGroupName = resourceGroupName; this.resourceName = resourceName; @@ -71,12 +65,7 @@ public CertificateDescription create() { .serviceClient() .getCertificates() .createOrUpdateWithResponse( - resourceGroupName, - resourceName, - certificateName, - createCertificateDescription, - createIfMatch, - Context.NONE) + resourceGroupName, resourceName, certificateName, this.innerModel(), createIfMatch, Context.NONE) .getValue(); return this; } @@ -87,27 +76,20 @@ public CertificateDescription create(Context context) { .serviceClient() .getCertificates() .createOrUpdateWithResponse( - resourceGroupName, - resourceName, - certificateName, - createCertificateDescription, - createIfMatch, - context) + resourceGroupName, resourceName, certificateName, this.innerModel(), createIfMatch, context) .getValue(); return this; } - CertificateDescriptionImpl(String name, IotHubManager serviceManager) { + CertificateDescriptionImpl(String name, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = new CertificateDescriptionInner(); this.serviceManager = serviceManager; this.certificateName = name; this.createIfMatch = null; - this.createCertificateDescription = new CertificateBodyDescription(); } public CertificateDescriptionImpl update() { this.updateIfMatch = null; - this.updateCertificateDescription = new CertificateBodyDescription(); return this; } @@ -117,12 +99,7 @@ public CertificateDescription apply() { .serviceClient() .getCertificates() .createOrUpdateWithResponse( - resourceGroupName, - resourceName, - certificateName, - updateCertificateDescription, - updateIfMatch, - Context.NONE) + resourceGroupName, resourceName, certificateName, this.innerModel(), updateIfMatch, Context.NONE) .getValue(); return this; } @@ -133,17 +110,13 @@ public CertificateDescription apply(Context context) { .serviceClient() .getCertificates() .createOrUpdateWithResponse( - resourceGroupName, - resourceName, - certificateName, - updateCertificateDescription, - updateIfMatch, - context) + resourceGroupName, resourceName, certificateName, this.innerModel(), updateIfMatch, context) .getValue(); return this; } - CertificateDescriptionImpl(CertificateDescriptionInner innerObject, IotHubManager serviceManager) { + CertificateDescriptionImpl( + CertificateDescriptionInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -171,27 +144,18 @@ public CertificateDescription refresh(Context context) { return this; } - public CertificateDescriptionImpl withCertificate(String certificate) { - if (isInCreateMode()) { - this.createCertificateDescription.withCertificate(certificate); - return this; - } else { - this.updateCertificateDescription.withCertificate(certificate); - return this; - } + public CertificateDescriptionImpl withProperties(CertificateProperties properties) { + this.innerModel().withProperties(properties); + return this; } public CertificateDescriptionImpl withIfMatch(String ifMatch) { - if (isInCreateMode()) { - this.createIfMatch = ifMatch; - return this; - } else { - this.updateIfMatch = ifMatch; - return this; - } + this.createIfMatch = ifMatch; + return this; } - private boolean isInCreateMode() { - return this.innerModel().id() == null; + public CertificateDescriptionImpl ifMatch(String ifMatch) { + this.updateIfMatch = ifMatch; + return this; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java index fb088b0a32e4..f8af1dfe73fc 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateListDescriptionImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; import com.azure.resourcemanager.iothub.models.CertificateDescription; @@ -16,9 +15,10 @@ public final class CertificateListDescriptionImpl implements CertificateListDescription { private CertificateListDescriptionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - CertificateListDescriptionImpl(CertificateListDescriptionInner innerObject, IotHubManager serviceManager) { + CertificateListDescriptionImpl( + CertificateListDescriptionInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -41,7 +41,7 @@ public CertificateListDescriptionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java index 0376d3e2e301..f88bf6f8006d 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificateWithNonceDescriptionImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; import com.azure.resourcemanager.iothub.models.CertificatePropertiesWithNonce; import com.azure.resourcemanager.iothub.models.CertificateWithNonceDescription; @@ -12,10 +11,11 @@ public final class CertificateWithNonceDescriptionImpl implements CertificateWithNonceDescription { private CertificateWithNonceDescriptionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; CertificateWithNonceDescriptionImpl( - CertificateWithNonceDescriptionInner innerObject, IotHubManager serviceManager) { + CertificateWithNonceDescriptionInner innerObject, + com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -44,7 +44,7 @@ public CertificateWithNonceDescriptionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java index ba2b12cf3ffa..656d8a942edd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesClientImpl.java @@ -29,7 +29,6 @@ import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateWithNonceDescriptionInner; -import com.azure.resourcemanager.iothub.models.CertificateBodyDescription; import com.azure.resourcemanager.iothub.models.CertificateVerificationDescription; import com.azure.resourcemanager.iothub.models.ErrorDetailsException; import reactor.core.publisher.Mono; @@ -107,7 +106,7 @@ Mono> createOrUpdate( @PathParam("resourceName") String resourceName, @PathParam("certificateName") String certificateName, @HeaderParam("If-Match") String ifMatch, - @BodyParam("application/json") CertificateBodyDescription certificateDescription, + @BodyParam("application/json") CertificateDescriptionInner certificateDescription, @HeaderParam("Accept") String accept, Context context); @@ -209,7 +208,7 @@ private Mono> listByIotHubWithResponse resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -364,7 +363,7 @@ private Mono> getWithResponseAsync( certificateName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -497,7 +496,7 @@ private Mono> createOrUpdateWithResponseAs String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription, + CertificateDescriptionInner certificateDescription, String ifMatch) { if (this.client.getEndpoint() == null) { return Mono @@ -545,7 +544,7 @@ private Mono> createOrUpdateWithResponseAs certificateDescription, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -568,7 +567,7 @@ private Mono> createOrUpdateWithResponseAs String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription, + CertificateDescriptionInner certificateDescription, String ifMatch, Context context) { if (this.client.getEndpoint() == null) { @@ -636,7 +635,7 @@ private Mono createOrUpdateAsync( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription, + CertificateDescriptionInner certificateDescription, String ifMatch) { return createOrUpdateWithResponseAsync( resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) @@ -667,7 +666,7 @@ private Mono createOrUpdateAsync( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription) { + CertificateDescriptionInner certificateDescription) { final String ifMatch = null; return createOrUpdateWithResponseAsync( resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) @@ -698,7 +697,7 @@ public CertificateDescriptionInner createOrUpdate( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription) { + CertificateDescriptionInner certificateDescription) { final String ifMatch = null; return createOrUpdateAsync(resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch) .block(); @@ -724,7 +723,7 @@ public Response createOrUpdateWithResponse( String resourceGroupName, String resourceName, String certificateName, - CertificateBodyDescription certificateDescription, + CertificateDescriptionInner certificateDescription, String ifMatch, Context context) { return createOrUpdateWithResponseAsync( @@ -788,7 +787,7 @@ private Mono> deleteWithResponseAsync( ifMatch, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -959,7 +958,7 @@ private Mono> generateVerificatio ifMatch, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1159,7 +1158,7 @@ private Mono> verifyWithResponseAsync( certificateVerificationBody, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java index a77db696aabd..07c0bd873816 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/CertificatesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.CertificatesClient; import com.azure.resourcemanager.iothub.fluent.models.CertificateDescriptionInner; import com.azure.resourcemanager.iothub.fluent.models.CertificateListDescriptionInner; @@ -25,9 +24,10 @@ public final class CertificatesImpl implements Certificates { private final CertificatesClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public CertificatesImpl(CertificatesClient innerClient, IotHubManager serviceManager) { + public CertificatesImpl( + CertificatesClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -271,7 +271,7 @@ private CertificatesClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java index 8651c1880c91..54567d44118a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EndpointHealthDataImpl.java @@ -4,17 +4,18 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; import com.azure.resourcemanager.iothub.models.EndpointHealthData; import com.azure.resourcemanager.iothub.models.EndpointHealthStatus; +import java.time.OffsetDateTime; public final class EndpointHealthDataImpl implements EndpointHealthData { private EndpointHealthDataInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - EndpointHealthDataImpl(EndpointHealthDataInner innerObject, IotHubManager serviceManager) { + EndpointHealthDataImpl( + EndpointHealthDataInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -27,11 +28,27 @@ public EndpointHealthStatus healthStatus() { return this.innerModel().healthStatus(); } + public String lastKnownError() { + return this.innerModel().lastKnownError(); + } + + public OffsetDateTime lastKnownErrorTime() { + return this.innerModel().lastKnownErrorTime(); + } + + public OffsetDateTime lastSuccessfulSendAttemptTime() { + return this.innerModel().lastSuccessfulSendAttemptTime(); + } + + public OffsetDateTime lastSendAttemptTime() { + return this.innerModel().lastSendAttemptTime(); + } + public EndpointHealthDataInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java index eccfc30e7d7f..6d569a82cf54 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/EventHubConsumerGroupInfoImpl.java @@ -4,18 +4,22 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; +import com.azure.core.util.Context; import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupInfo; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupName; import java.util.Collections; import java.util.Map; -public final class EventHubConsumerGroupInfoImpl implements EventHubConsumerGroupInfo { +public final class EventHubConsumerGroupInfoImpl + implements EventHubConsumerGroupInfo, EventHubConsumerGroupInfo.Definition { private EventHubConsumerGroupInfoInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - EventHubConsumerGroupInfoImpl(EventHubConsumerGroupInfoInner innerObject, IotHubManager serviceManager) { + EventHubConsumerGroupInfoImpl( + EventHubConsumerGroupInfoInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -49,7 +53,81 @@ public EventHubConsumerGroupInfoInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } + + private String resourceGroupName; + + private String resourceName; + + private String eventHubEndpointName; + + private String name; + + private EventHubConsumerGroupBodyDescription createConsumerGroupBody; + + public EventHubConsumerGroupInfoImpl withExistingEventHubEndpoint( + String resourceGroupName, String resourceName, String eventHubEndpointName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + this.eventHubEndpointName = eventHubEndpointName; + return this; + } + + public EventHubConsumerGroupInfo create() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, createConsumerGroupBody, Context.NONE) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfo create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .createEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, createConsumerGroupBody, context) + .getValue(); + return this; + } + + EventHubConsumerGroupInfoImpl(String name, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { + this.innerObject = new EventHubConsumerGroupInfoInner(); + this.serviceManager = serviceManager; + this.name = name; + this.createConsumerGroupBody = new EventHubConsumerGroupBodyDescription(); + } + + public EventHubConsumerGroupInfo refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfo refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIotHubResources() + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context) + .getValue(); + return this; + } + + public EventHubConsumerGroupInfoImpl withProperties(EventHubConsumerGroupName properties) { + this.createConsumerGroupBody.withProperties(properties); + return this; + } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java index 2a4b7cc3d9db..f59f807fb09d 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/GroupIdInformationImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; import com.azure.resourcemanager.iothub.models.GroupIdInformation; import com.azure.resourcemanager.iothub.models.GroupIdInformationProperties; @@ -12,9 +11,10 @@ public final class GroupIdInformationImpl implements GroupIdInformation { private GroupIdInformationInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - GroupIdInformationImpl(GroupIdInformationInner innerObject, IotHubManager serviceManager) { + GroupIdInformationImpl( + GroupIdInformationInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -39,7 +39,7 @@ public GroupIdInformationInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java index f39fb205e7d0..c2abdf4a1d10 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubClientImpl.java @@ -222,7 +222,7 @@ public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-03-01"; + this.apiVersion = "2021-03-03-preview"; this.operations = new OperationsClientImpl(this); this.iotHubResources = new IotHubResourcesClientImpl(this); this.resourceProviderCommons = new ResourceProviderCommonsClientImpl(this); diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java index b981fb1ce4c1..660420847382 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubDescriptionImpl.java @@ -8,8 +8,8 @@ import com.azure.core.http.rest.Response; import com.azure.core.management.Region; import com.azure.core.util.Context; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.IotHubDescriptionInner; +import com.azure.resourcemanager.iothub.models.ArmIdentity; import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; import com.azure.resourcemanager.iothub.models.IotHubDescription; @@ -25,7 +25,7 @@ public final class IotHubDescriptionImpl implements IotHubDescription, IotHubDescription.Definition, IotHubDescription.Update { private IotHubDescriptionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; public String id() { return this.innerModel().id(); @@ -64,6 +64,10 @@ public IotHubSkuInfo sku() { return this.innerModel().sku(); } + public ArmIdentity identity() { + return this.innerModel().identity(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -76,7 +80,7 @@ public IotHubDescriptionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } @@ -111,7 +115,7 @@ public IotHubDescription create(Context context) { return this; } - IotHubDescriptionImpl(String name, IotHubManager serviceManager) { + IotHubDescriptionImpl(String name, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = new IotHubDescriptionInner(); this.serviceManager = serviceManager; this.resourceName = name; @@ -141,7 +145,8 @@ public IotHubDescription apply(Context context) { return this; } - IotHubDescriptionImpl(IotHubDescriptionInner innerObject, IotHubManager serviceManager) { + IotHubDescriptionImpl( + IotHubDescriptionInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); @@ -233,6 +238,11 @@ public IotHubDescriptionImpl withProperties(IotHubProperties properties) { return this; } + public IotHubDescriptionImpl withIdentity(ArmIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + public IotHubDescriptionImpl withIfMatch(String ifMatch) { this.createIfMatch = ifMatch; return this; diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java index 630ffccd4b67..dd131206d882 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubNameAvailabilityInfoImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.IotHubNameAvailabilityInfoInner; import com.azure.resourcemanager.iothub.models.IotHubNameAvailabilityInfo; import com.azure.resourcemanager.iothub.models.IotHubNameUnavailabilityReason; @@ -12,9 +11,10 @@ public final class IotHubNameAvailabilityInfoImpl implements IotHubNameAvailabilityInfo { private IotHubNameAvailabilityInfoInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - IotHubNameAvailabilityInfoImpl(IotHubNameAvailabilityInfoInner innerObject, IotHubManager serviceManager) { + IotHubNameAvailabilityInfoImpl( + IotHubNameAvailabilityInfoInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -35,7 +35,7 @@ public IotHubNameAvailabilityInfoInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java index e42e748285ef..f6f4212c0843 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubQuotaMetricInfoImpl.java @@ -4,16 +4,16 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.IotHubQuotaMetricInfoInner; import com.azure.resourcemanager.iothub.models.IotHubQuotaMetricInfo; public final class IotHubQuotaMetricInfoImpl implements IotHubQuotaMetricInfo { private IotHubQuotaMetricInfoInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - IotHubQuotaMetricInfoImpl(IotHubQuotaMetricInfoInner innerObject, IotHubManager serviceManager) { + IotHubQuotaMetricInfoImpl( + IotHubQuotaMetricInfoInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -34,7 +34,7 @@ public IotHubQuotaMetricInfoInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java index 38c510848116..0e9628c455d5 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesClientImpl.java @@ -48,6 +48,7 @@ import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; import com.azure.resourcemanager.iothub.models.EndpointHealthDataListResult; import com.azure.resourcemanager.iothub.models.ErrorDetailsException; +import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupBodyDescription; import com.azure.resourcemanager.iothub.models.EventHubConsumerGroupsListResult; import com.azure.resourcemanager.iothub.models.ExportDevicesRequest; import com.azure.resourcemanager.iothub.models.ImportDevicesRequest; @@ -255,6 +256,7 @@ Mono> createEventHubConsumerGroup( @PathParam("resourceName") String resourceName, @PathParam("eventHubEndpointName") String eventHubEndpointName, @PathParam("name") String name, + @BodyParam("application/json") EventHubConsumerGroupBodyDescription consumerGroupBody, @HeaderParam("Accept") String accept, Context context); @@ -569,7 +571,7 @@ private Mono> getByResourceGroupWithResponseAsy resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -731,7 +733,7 @@ private Mono>> createOrUpdateWithResponseAsync( iotHubDescription, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1103,7 +1105,7 @@ private Mono>> updateWithResponseAsync( iotHubTags, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1364,7 +1366,7 @@ private Mono>> deleteWithResponseAsync(String resource resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1601,7 +1603,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1749,7 +1751,7 @@ private Mono> listByResourceGroupSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1909,7 +1911,7 @@ private Mono> getStatsWithResponseAsync( resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2067,7 +2069,7 @@ private Mono> getValidSkusSinglePageAsy res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2253,7 +2255,7 @@ private Mono> listEventHubConsumer res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2451,7 +2453,7 @@ private Mono> getEventHubConsumerGroupW name, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2583,6 +2585,7 @@ public Response getEventHubConsumerGroupWithResp * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2590,7 +2593,11 @@ public Response getEventHubConsumerGroupWithResp */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createEventHubConsumerGroupWithResponseAsync( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2617,6 +2624,12 @@ private Mono> createEventHubConsumerGro if (name == null) { return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); } + if (consumerGroupBody == null) { + return Mono + .error(new IllegalArgumentException("Parameter consumerGroupBody is required and cannot be null.")); + } else { + consumerGroupBody.validate(); + } final String accept = "application/json"; return FluxUtil .withContext( @@ -2630,9 +2643,10 @@ private Mono> createEventHubConsumerGro resourceName, eventHubEndpointName, name, + consumerGroupBody, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2642,6 +2656,7 @@ private Mono> createEventHubConsumerGro * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. @@ -2650,7 +2665,12 @@ private Mono> createEventHubConsumerGro */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createEventHubConsumerGroupWithResponseAsync( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -2677,6 +2697,12 @@ private Mono> createEventHubConsumerGro if (name == null) { return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); } + if (consumerGroupBody == null) { + return Mono + .error(new IllegalArgumentException("Parameter consumerGroupBody is required and cannot be null.")); + } else { + consumerGroupBody.validate(); + } final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -2688,6 +2714,7 @@ private Mono> createEventHubConsumerGro resourceName, eventHubEndpointName, name, + consumerGroupBody, accept, context); } @@ -2699,6 +2726,7 @@ private Mono> createEventHubConsumerGro * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2706,8 +2734,13 @@ private Mono> createEventHubConsumerGro */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createEventHubConsumerGroupAsync( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { - return createEventHubConsumerGroupWithResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name) + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { + return createEventHubConsumerGroupWithResponseAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody) .flatMap( (Response res) -> { if (res.getValue() != null) { @@ -2725,6 +2758,7 @@ private Mono createEventHubConsumerGroupAsync( * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2732,8 +2766,14 @@ private Mono createEventHubConsumerGroupAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public EventHubConsumerGroupInfoInner createEventHubConsumerGroup( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { - return createEventHubConsumerGroupAsync(resourceGroupName, resourceName, eventHubEndpointName, name).block(); + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody) { + return createEventHubConsumerGroupAsync( + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody) + .block(); } /** @@ -2743,6 +2783,7 @@ public EventHubConsumerGroupInfoInner createEventHubConsumerGroup( * @param resourceName The name of the IoT hub. * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. * @param name The name of the consumer group to add. + * @param consumerGroupBody The consumer group to add. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorDetailsException thrown if the request is rejected by server. @@ -2751,9 +2792,14 @@ public EventHubConsumerGroupInfoInner createEventHubConsumerGroup( */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createEventHubConsumerGroupWithResponse( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { + String resourceGroupName, + String resourceName, + String eventHubEndpointName, + String name, + EventHubConsumerGroupBodyDescription consumerGroupBody, + Context context) { return createEventHubConsumerGroupWithResponseAsync( - resourceGroupName, resourceName, eventHubEndpointName, name, context) + resourceGroupName, resourceName, eventHubEndpointName, name, consumerGroupBody, context) .block(); } @@ -2813,7 +2859,7 @@ private Mono> deleteEventHubConsumerGroupWithResponseAsync( name, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -2985,7 +3031,7 @@ private Mono> listJobsSinglePageAsync( res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3165,7 +3211,7 @@ private Mono> getJobWithResponseAsync( jobId, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3335,7 +3381,7 @@ private Mono> getQuotaMetricsSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3515,7 +3561,7 @@ private Mono> getEndpointHealthSinglePage res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3684,7 +3730,7 @@ private Mono> checkNameAvailabilityWit operationInputs, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -3838,7 +3884,7 @@ private Mono> testAllRoutesWithResponseAsync( input, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4006,7 +4052,7 @@ private Mono> testRouteWithResponseAsync( input, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4176,7 +4222,7 @@ private Mono> listKey res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4360,7 +4406,7 @@ private Mono> getKeysForKe keyName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4534,7 +4580,7 @@ private Mono> exportDevicesWithResponseAsync( exportDevicesParameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4717,7 +4763,7 @@ private Mono> importDevicesWithResponseAsync( importDevicesParameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4877,7 +4923,7 @@ private Mono> listBySubscriptionNextSingle res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -4950,7 +4996,7 @@ private Mono> listByResourceGroupNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5022,7 +5068,7 @@ private Mono> getValidSkusNextSinglePag res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5096,7 +5142,7 @@ private Mono> listEventHubConsumer res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5168,7 +5214,7 @@ private Mono> listJobsNextSinglePageAsync(String res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5239,7 +5285,7 @@ private Mono> getQuotaMetricsNextSingl res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5311,7 +5357,7 @@ private Mono> getEndpointHealthNextSingle res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -5384,7 +5430,7 @@ private Mono> listKey res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java index 267842c48ba6..55ab18982c3c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubResourcesImpl.java @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.IotHubResourcesClient; import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; import com.azure.resourcemanager.iothub.fluent.models.EventHubConsumerGroupInfoInner; @@ -46,9 +45,10 @@ public final class IotHubResourcesImpl implements IotHubResources { private final IotHubResourcesClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public IotHubResourcesImpl(IotHubResourcesClient innerClient, IotHubManager serviceManager) { + public IotHubResourcesImpl( + IotHubResourcesClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -198,37 +198,6 @@ public Response getEventHubConsumerGroupWithResponse( } } - public EventHubConsumerGroupInfo createEventHubConsumerGroup( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { - EventHubConsumerGroupInfoInner inner = - this - .serviceClient() - .createEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name); - if (inner != null) { - return new EventHubConsumerGroupInfoImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response createEventHubConsumerGroupWithResponse( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context) { - Response inner = - this - .serviceClient() - .createEventHubConsumerGroupWithResponse( - resourceGroupName, resourceName, eventHubEndpointName, name, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new EventHubConsumerGroupInfoImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - public void deleteEventHubConsumerGroup( String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { this.serviceClient().deleteEventHubConsumerGroup(resourceGroupName, resourceName, eventHubEndpointName, name); @@ -508,6 +477,82 @@ public Response getByIdWithResponse(String id, Context contex return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); } + public EventHubConsumerGroupInfo getEventHubConsumerGroupById(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 resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .getEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + } + + public Response getEventHubConsumerGroupByIdWithResponse(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 resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .getEventHubConsumerGroupWithResponse(resourceGroupName, resourceName, eventHubEndpointName, name, context); + } + public IotHubDescription deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { @@ -546,15 +591,96 @@ public IotHubDescription deleteByIdWithResponse(String id, Context context) { return this.delete(resourceGroupName, resourceName, context); } + public void deleteEventHubConsumerGroupById(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 resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + this + .deleteEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, Context.NONE) + .getValue(); + } + + public Response deleteEventHubConsumerGroupByIdWithResponse(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 resourceName = Utils.getValueFromIdByName(id, "IotHubs"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'IotHubs'.", id))); + } + String eventHubEndpointName = Utils.getValueFromIdByName(id, "eventHubEndpoints"); + if (eventHubEndpointName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'eventHubEndpoints'.", id))); + } + String name = Utils.getValueFromIdByName(id, "ConsumerGroups"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'ConsumerGroups'.", id))); + } + return this + .deleteEventHubConsumerGroupWithResponse( + resourceGroupName, resourceName, eventHubEndpointName, name, context); + } + private IotHubResourcesClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } public IotHubDescriptionImpl define(String name) { return new IotHubDescriptionImpl(name, this.manager()); } + + public EventHubConsumerGroupInfoImpl defineEventHubConsumerGroup(String name) { + return new EventHubConsumerGroupInfoImpl(name, this.manager()); + } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java index 25d847277284..7eaf686911f6 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubSkuDescriptionImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.IotHubSkuDescriptionInner; import com.azure.resourcemanager.iothub.models.IotHubCapacity; import com.azure.resourcemanager.iothub.models.IotHubSkuDescription; @@ -13,9 +12,10 @@ public final class IotHubSkuDescriptionImpl implements IotHubSkuDescription { private IotHubSkuDescriptionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - IotHubSkuDescriptionImpl(IotHubSkuDescriptionInner innerObject, IotHubManager serviceManager) { + IotHubSkuDescriptionImpl( + IotHubSkuDescriptionInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -36,7 +36,7 @@ public IotHubSkuDescriptionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java index 858554288623..d42e8e128b89 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsClientImpl.java @@ -130,7 +130,7 @@ private Mono>> manualFailoverWithResponseAsync( failoverInput, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java index a4d108035a19..2ee870445f97 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/IotHubsImpl.java @@ -6,7 +6,6 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.IotHubsClient; import com.azure.resourcemanager.iothub.models.FailoverInput; import com.azure.resourcemanager.iothub.models.IotHubs; @@ -17,9 +16,9 @@ public final class IotHubsImpl implements IotHubs { private final IotHubsClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public IotHubsImpl(IotHubsClient innerClient, IotHubManager serviceManager) { + public IotHubsImpl(IotHubsClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -37,7 +36,7 @@ private IotHubsClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java index 4b3aa398cbc5..654ba0244d28 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/JobResponseImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.JobResponseInner; import com.azure.resourcemanager.iothub.models.JobResponse; import com.azure.resourcemanager.iothub.models.JobStatus; @@ -14,9 +13,9 @@ public final class JobResponseImpl implements JobResponse { private JobResponseInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - JobResponseImpl(JobResponseInner innerObject, IotHubManager serviceManager) { + JobResponseImpl(JobResponseInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -57,7 +56,7 @@ public JobResponseInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java index 7d755e0011bc..6cac9e2c1f0a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.OperationInner; import com.azure.resourcemanager.iothub.models.Operation; import com.azure.resourcemanager.iothub.models.OperationDisplay; @@ -12,9 +11,9 @@ public final class OperationImpl implements Operation { private OperationInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - OperationImpl(OperationInner innerObject, IotHubManager serviceManager) { + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -31,7 +30,7 @@ public OperationInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java index 547a43f92307..94e4d156d134 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsClientImpl.java @@ -108,7 +108,7 @@ private Mono> listSinglePageAsync() { res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -228,7 +228,7 @@ private Mono> listNextSinglePageAsync(String nextL res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java index 44790e196743..dcb6e102be61 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/OperationsImpl.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.OperationsClient; import com.azure.resourcemanager.iothub.fluent.models.OperationInner; import com.azure.resourcemanager.iothub.models.Operation; @@ -19,9 +18,9 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public OperationsImpl(OperationsClient innerClient, IotHubManager serviceManager) { + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -40,7 +39,7 @@ private OperationsClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java index 90ba410f0721..72ea847ab7a2 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.iothub.models.PrivateEndpointConnection; import com.azure.resourcemanager.iothub.models.PrivateEndpointConnectionProperties; @@ -12,9 +11,10 @@ public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection { private PrivateEndpointConnectionInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, IotHubManager serviceManager) { + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -39,7 +39,7 @@ public PrivateEndpointConnectionInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java index 1835cd3339f1..513136f57137 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsClientImpl.java @@ -175,7 +175,7 @@ private Mono>> listWithResponseAsy resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -332,7 +332,7 @@ private Mono> getWithResponseAsync( privateEndpointConnectionName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -515,7 +515,7 @@ private Mono>> updateWithResponseAsync( privateEndpointConnection, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -849,7 +849,7 @@ private Mono>> deleteWithResponseAsync( privateEndpointConnectionName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java index a5943d4f224d..364d3408cb34 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateEndpointConnectionsImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.iothub.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.iothub.models.PrivateEndpointConnection; @@ -23,9 +22,10 @@ public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConn private final PrivateEndpointConnectionsClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, IotHubManager serviceManager) { + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -151,7 +151,7 @@ private PrivateEndpointConnectionsClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java index 94e53c7a8099..f7212884839b 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; import com.azure.resourcemanager.iothub.models.GroupIdInformation; @@ -16,9 +15,10 @@ public final class PrivateLinkResourcesImpl implements PrivateLinkResources { private PrivateLinkResourcesInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - PrivateLinkResourcesImpl(PrivateLinkResourcesInner innerObject, IotHubManager serviceManager) { + PrivateLinkResourcesImpl( + PrivateLinkResourcesInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -41,7 +41,7 @@ public PrivateLinkResourcesInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java index 5a5f18c8bca7..47f4f23acf59 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsClientImpl.java @@ -136,7 +136,7 @@ private Mono> listWithResponseAsync( resourceName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -290,7 +290,7 @@ private Mono> getWithResponseAsync( groupId, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java index 2d3abdded3ed..aa81656c3702 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/PrivateLinkResourcesOperationsImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.PrivateLinkResourcesOperationsClient; import com.azure.resourcemanager.iothub.fluent.models.GroupIdInformationInner; import com.azure.resourcemanager.iothub.fluent.models.PrivateLinkResourcesInner; @@ -22,10 +21,11 @@ public final class PrivateLinkResourcesOperationsImpl implements PrivateLinkReso private final PrivateLinkResourcesOperationsClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; public PrivateLinkResourcesOperationsImpl( - PrivateLinkResourcesOperationsClient innerClient, IotHubManager serviceManager) { + PrivateLinkResourcesOperationsClient innerClient, + com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -82,7 +82,7 @@ private PrivateLinkResourcesOperationsClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java index b9a87a1539ce..e0c8ad2d14b3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/RegistryStatisticsImpl.java @@ -4,16 +4,16 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.RegistryStatisticsInner; import com.azure.resourcemanager.iothub.models.RegistryStatistics; public final class RegistryStatisticsImpl implements RegistryStatistics { private RegistryStatisticsInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - RegistryStatisticsImpl(RegistryStatisticsInner innerObject, IotHubManager serviceManager) { + RegistryStatisticsImpl( + RegistryStatisticsInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -34,7 +34,7 @@ public RegistryStatisticsInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java index ed6a7ca71013..c11fc0d42545 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsClientImpl.java @@ -99,7 +99,7 @@ private Mono> getSubscriptionQuot this.client.getApiVersion(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java index e6cb3786eee5..baa39c4baf87 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/ResourceProviderCommonsImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.ResourceProviderCommonsClient; import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; import com.azure.resourcemanager.iothub.models.ResourceProviderCommons; @@ -20,9 +19,10 @@ public final class ResourceProviderCommonsImpl implements ResourceProviderCommon private final ResourceProviderCommonsClient innerClient; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - public ResourceProviderCommonsImpl(ResourceProviderCommonsClient innerClient, IotHubManager serviceManager) { + public ResourceProviderCommonsImpl( + ResourceProviderCommonsClient innerClient, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -54,7 +54,7 @@ private ResourceProviderCommonsClient serviceClient() { return this.innerClient; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java index 150d9d3570da..fada962f9d65 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/SharedAccessSignatureAuthorizationRuleImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.SharedAccessSignatureAuthorizationRuleInner; import com.azure.resourcemanager.iothub.models.AccessRights; import com.azure.resourcemanager.iothub.models.SharedAccessSignatureAuthorizationRule; @@ -12,10 +11,11 @@ public final class SharedAccessSignatureAuthorizationRuleImpl implements SharedAccessSignatureAuthorizationRule { private SharedAccessSignatureAuthorizationRuleInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; SharedAccessSignatureAuthorizationRuleImpl( - SharedAccessSignatureAuthorizationRuleInner innerObject, IotHubManager serviceManager) { + SharedAccessSignatureAuthorizationRuleInner innerObject, + com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -40,7 +40,7 @@ public SharedAccessSignatureAuthorizationRuleInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java index 4af9568b52ed..c0ef483667ea 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestAllRoutesResultImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.TestAllRoutesResultInner; import com.azure.resourcemanager.iothub.models.MatchedRoute; import com.azure.resourcemanager.iothub.models.TestAllRoutesResult; @@ -14,9 +13,10 @@ public final class TestAllRoutesResultImpl implements TestAllRoutesResult { private TestAllRoutesResultInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - TestAllRoutesResultImpl(TestAllRoutesResultInner innerObject, IotHubManager serviceManager) { + TestAllRoutesResultImpl( + TestAllRoutesResultInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -34,7 +34,7 @@ public TestAllRoutesResultInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java index 1c2440653f39..842ae33f991e 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/TestRouteResultImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.TestRouteResultInner; import com.azure.resourcemanager.iothub.models.TestResultStatus; import com.azure.resourcemanager.iothub.models.TestRouteResult; @@ -13,9 +12,10 @@ public final class TestRouteResultImpl implements TestRouteResult { private TestRouteResultInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; - TestRouteResultImpl(TestRouteResultInner innerObject, IotHubManager serviceManager) { + TestRouteResultImpl( + TestRouteResultInner innerObject, com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -32,7 +32,7 @@ public TestRouteResultInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java index 2d567ed3f87e..84e80070519c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/UserSubscriptionQuotaListResultImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.iothub.implementation; -import com.azure.resourcemanager.iothub.IotHubManager; import com.azure.resourcemanager.iothub.fluent.models.UserSubscriptionQuotaListResultInner; import com.azure.resourcemanager.iothub.models.UserSubscriptionQuota; import com.azure.resourcemanager.iothub.models.UserSubscriptionQuotaListResult; @@ -14,10 +13,11 @@ public final class UserSubscriptionQuotaListResultImpl implements UserSubscriptionQuotaListResult { private UserSubscriptionQuotaListResultInner innerObject; - private final IotHubManager serviceManager; + private final com.azure.resourcemanager.iothub.IotHubManager serviceManager; UserSubscriptionQuotaListResultImpl( - UserSubscriptionQuotaListResultInner innerObject, IotHubManager serviceManager) { + UserSubscriptionQuotaListResultInner innerObject, + com.azure.resourcemanager.iothub.IotHubManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -39,7 +39,7 @@ public UserSubscriptionQuotaListResultInner innerModel() { return this.innerObject; } - private IotHubManager manager() { + private com.azure.resourcemanager.iothub.IotHubManager manager() { return this.serviceManager; } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java index b95b868cf0fb..cea847d94b27 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/implementation/Utils.java @@ -9,8 +9,6 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.CoreUtils; -import reactor.core.publisher.Mono; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -19,6 +17,7 @@ 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) { @@ -80,76 +79,84 @@ static PagedIterable mapPage(PagedIterable pageIterable, Function extends PagedIterable { - private final PagedIterable pageIterable; + private final PagedIterable pagedIterable; private final Function mapper; private final Function, PagedResponse> pageMapper; - private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { - super(new PagedFlux(() -> Mono.empty())); - this.pageIterable = pageIterable; + 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 = - page -> - new PagedResponseBase( - page.getRequest(), - page.getStatusCode(), - page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), - page.getContinuationToken(), - null); + 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 pageIterable.stream().map(mapper); + return pagedIterable.stream().map(mapper); } @Override public Stream> streamByPage() { - return pageIterable.streamByPage().map(pageMapper); + return pagedIterable.streamByPage().map(pageMapper); } @Override public Stream> streamByPage(String continuationToken) { - return pageIterable.streamByPage(continuationToken).map(pageMapper); + return pagedIterable.streamByPage(continuationToken).map(pageMapper); } @Override public Stream> streamByPage(int preferredPageSize) { - return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); } @Override public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); } @Override public Iterator iterator() { - return new IteratorImpl(pageIterable.iterator(), mapper); + return new IteratorImpl(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { return new IterableImpl, PagedResponse>( - pageIterable.iterableByPage(continuationToken), pageMapper); + pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { return new IterableImpl, PagedResponse>( - pageIterable.iterableByPage(preferredPageSize), pageMapper); + pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { return new IterableImpl, PagedResponse>( - pageIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java new file mode 100644 index 000000000000..79eb767e5a8d --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmIdentity.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ArmIdentity model. */ +@Fluent +public class ArmIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmIdentity.class); + + /* + * Principal Id + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * Tenant Id + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the resource. The type + * 'SystemAssigned,UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the service. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * Dictionary of + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the principalId property: Principal Id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: Tenant Id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the service. + * + * @param type the type value to set. + * @return the ArmIdentity object itself. + */ + public ArmIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: Dictionary of <ArmUserIdentity>. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: Dictionary of <ArmUserIdentity>. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ArmIdentity object itself. + */ + public ArmIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmUserIdentity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmUserIdentity.java new file mode 100644 index 000000000000..8ce8ce614807 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ArmUserIdentity.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ArmUserIdentity model. */ +@Immutable +public class ArmUserIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmUserIdentity.class); + + /* + * The principalId property. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The clientId property. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principalId property. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The clientId property. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateBodyDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateBodyDescription.java deleted file mode 100644 index 920af42ee369..000000000000 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateBodyDescription.java +++ /dev/null @@ -1,53 +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.iothub.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The JSON-serialized X509 Certificate. */ -@Fluent -public final class CertificateBodyDescription { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateBodyDescription.class); - - /* - * base-64 representation of the X509 leaf certificate .cer file or just - * .pem file content. - */ - @JsonProperty(value = "certificate") - private String certificate; - - /** - * Get the certificate property: base-64 representation of the X509 leaf certificate .cer file or just .pem file - * content. - * - * @return the certificate value. - */ - public String certificate() { - return this.certificate; - } - - /** - * Set the certificate property: base-64 representation of the X509 leaf certificate .cer file or just .pem file - * content. - * - * @param certificate the certificate value to set. - * @return the CertificateBodyDescription object itself. - */ - public CertificateBodyDescription withCertificate(String certificate) { - this.certificate = certificate; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java index 1229ac59f675..c4e7a42846f3 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/CertificateDescription.java @@ -75,7 +75,7 @@ interface WithParentResource { * The stage of the CertificateDescription 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.WithCertificate, DefinitionStages.WithIfMatch { + interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.WithIfMatch { /** * Executes the create request. * @@ -91,17 +91,15 @@ interface WithCreate extends DefinitionStages.WithCertificate, DefinitionStages. */ CertificateDescription create(Context context); } - /** The stage of the CertificateDescription definition allowing to specify certificate. */ - interface WithCertificate { + /** The stage of the CertificateDescription definition allowing to specify properties. */ + interface WithProperties { /** - * Specifies the certificate property: base-64 representation of the X509 leaf certificate .cer file or just - * .pem file content.. + * Specifies the properties property: The description of an X509 CA Certificate.. * - * @param certificate base-64 representation of the X509 leaf certificate .cer file or just .pem file - * content. + * @param properties The description of an X509 CA Certificate. * @return the next definition stage. */ - WithCreate withCertificate(String certificate); + WithCreate withProperties(CertificateProperties properties); } /** The stage of the CertificateDescription definition allowing to specify ifMatch. */ interface WithIfMatch { @@ -124,7 +122,7 @@ interface WithIfMatch { CertificateDescription.Update update(); /** The template for CertificateDescription update. */ - interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch { + interface Update extends UpdateStages.WithProperties, UpdateStages.WithifMatch { /** * Executes the update request. * @@ -142,20 +140,18 @@ interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch } /** The CertificateDescription update stages. */ interface UpdateStages { - /** The stage of the CertificateDescription update allowing to specify certificate. */ - interface WithCertificate { + /** The stage of the CertificateDescription update allowing to specify properties. */ + interface WithProperties { /** - * Specifies the certificate property: base-64 representation of the X509 leaf certificate .cer file or just - * .pem file content.. + * Specifies the properties property: The description of an X509 CA Certificate.. * - * @param certificate base-64 representation of the X509 leaf certificate .cer file or just .pem file - * content. + * @param properties The description of an X509 CA Certificate. * @return the next definition stage. */ - Update withCertificate(String certificate); + Update withProperties(CertificateProperties properties); } /** The stage of the CertificateDescription update allowing to specify ifMatch. */ - interface WithIfMatch { + interface WithifMatch { /** * Specifies the ifMatch property: ETag of the Certificate. Do not specify for creating a brand new * certificate. Required to update an existing certificate.. @@ -164,7 +160,7 @@ interface WithIfMatch { * update an existing certificate. * @return the next definition stage. */ - Update withIfMatch(String ifMatch); + Update ifMatch(String ifMatch); } } /** diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.java new file mode 100644 index 000000000000..4731ff0dc046 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/DefaultAction.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DefaultAction. */ +public final class DefaultAction extends ExpandableStringEnum { + /** Static value Deny for DefaultAction. */ + public static final DefaultAction DENY = fromString("Deny"); + + /** Static value Allow for DefaultAction. */ + public static final DefaultAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a DefaultAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding DefaultAction. + */ + @JsonCreator + public static DefaultAction fromString(String name) { + return fromString(name, DefaultAction.class); + } + + /** @return known DefaultAction values. */ + public static Collection values() { + return values(DefaultAction.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java new file mode 100644 index 000000000000..0a4aa8924d48 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EncryptionPropertiesDescription.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The encryption properties for the IoT hub. */ +@Fluent +public final class EncryptionPropertiesDescription { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionPropertiesDescription.class); + + /* + * The source of the key. + */ + @JsonProperty(value = "keySource") + private String keySource; + + /* + * The properties of the KeyVault key. + */ + @JsonProperty(value = "keyVaultProperties") + private List keyVaultProperties; + + /** + * Get the keySource property: The source of the key. + * + * @return the keySource value. + */ + public String keySource() { + return this.keySource; + } + + /** + * Set the keySource property: The source of the key. + * + * @param keySource the keySource value to set. + * @return the EncryptionPropertiesDescription object itself. + */ + public EncryptionPropertiesDescription withKeySource(String keySource) { + this.keySource = keySource; + return this; + } + + /** + * Get the keyVaultProperties property: The properties of the KeyVault key. + * + * @return the keyVaultProperties value. + */ + public List keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The properties of the KeyVault key. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the EncryptionPropertiesDescription object itself. + */ + public EncryptionPropertiesDescription withKeyVaultProperties(List keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultProperties() != null) { + keyVaultProperties().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java index 70567df7e496..3ab6be25f96a 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthData.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.iothub.models; import com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner; +import java.time.OffsetDateTime; /** An immutable client-side representation of EndpointHealthData. */ public interface EndpointHealthData { @@ -29,6 +30,34 @@ public interface EndpointHealthData { */ EndpointHealthStatus healthStatus(); + /** + * Gets the lastKnownError property: Last error obtained when a message failed to be delivered to iot hub. + * + * @return the lastKnownError value. + */ + String lastKnownError(); + + /** + * Gets the lastKnownErrorTime property: Time at which the last known error occurred. + * + * @return the lastKnownErrorTime value. + */ + OffsetDateTime lastKnownErrorTime(); + + /** + * Gets the lastSuccessfulSendAttemptTime property: Last time iot hub successfully sent a message to the endpoint. + * + * @return the lastSuccessfulSendAttemptTime value. + */ + OffsetDateTime lastSuccessfulSendAttemptTime(); + + /** + * Gets the lastSendAttemptTime property: Last time iot hub tried to send a message to the endpoint. + * + * @return the lastSendAttemptTime value. + */ + OffsetDateTime lastSendAttemptTime(); + /** * Gets the inner com.azure.resourcemanager.iothub.fluent.models.EndpointHealthDataInner object. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java index 0e10d579ae18..29f6463f85dd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/EndpointHealthStatus.java @@ -16,6 +16,9 @@ public final class EndpointHealthStatus extends ExpandableStringEnum ipFilterRules; + /* + * Network Rule Set Properties of IotHub + */ + @JsonProperty(value = "networkRuleSets") + private NetworkRuleSetProperties networkRuleSets; + /* * Specifies the minimum TLS version to support for this hub. Can be set to * "1.2" to have clients that use a TLS version below 1.2 to be rejected. @@ -119,12 +125,24 @@ public final class IotHubProperties { @JsonProperty(value = "comments") private String comments; + /* + * The device streams properties of iothub. + */ + @JsonProperty(value = "deviceStreams") + private IotHubPropertiesDeviceStreams deviceStreams; + /* * The capabilities and features enabled for the IoT hub. */ @JsonProperty(value = "features") private Capabilities features; + /* + * The encryption properties for the IoT hub. + */ + @JsonProperty(value = "encryption") + private EncryptionPropertiesDescription encryption; + /* * Primary and secondary location for iot hub */ @@ -194,6 +212,26 @@ public IotHubProperties withIpFilterRules(List ipFilterRules) { return this; } + /** + * Get the networkRuleSets property: Network Rule Set Properties of IotHub. + * + * @return the networkRuleSets value. + */ + public NetworkRuleSetProperties networkRuleSets() { + return this.networkRuleSets; + } + + /** + * Set the networkRuleSets property: Network Rule Set Properties of IotHub. + * + * @param networkRuleSets the networkRuleSets value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withNetworkRuleSets(NetworkRuleSetProperties networkRuleSets) { + this.networkRuleSets = networkRuleSets; + return this; + } + /** * Get the minTlsVersion property: Specifies the minimum TLS version to support for this hub. Can be set to "1.2" to * have clients that use a TLS version below 1.2 to be rejected. @@ -416,6 +454,26 @@ public IotHubProperties withComments(String comments) { return this; } + /** + * Get the deviceStreams property: The device streams properties of iothub. + * + * @return the deviceStreams value. + */ + public IotHubPropertiesDeviceStreams deviceStreams() { + return this.deviceStreams; + } + + /** + * Set the deviceStreams property: The device streams properties of iothub. + * + * @param deviceStreams the deviceStreams value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withDeviceStreams(IotHubPropertiesDeviceStreams deviceStreams) { + this.deviceStreams = deviceStreams; + return this; + } + /** * Get the features property: The capabilities and features enabled for the IoT hub. * @@ -436,6 +494,26 @@ public IotHubProperties withFeatures(Capabilities features) { return this; } + /** + * Get the encryption property: The encryption properties for the IoT hub. + * + * @return the encryption value. + */ + public EncryptionPropertiesDescription encryption() { + return this.encryption; + } + + /** + * Set the encryption property: The encryption properties for the IoT hub. + * + * @param encryption the encryption value to set. + * @return the IotHubProperties object itself. + */ + public IotHubProperties withEncryption(EncryptionPropertiesDescription encryption) { + this.encryption = encryption; + return this; + } + /** * Get the locations property: Primary and secondary location for iot hub. * @@ -457,6 +535,9 @@ public void validate() { if (ipFilterRules() != null) { ipFilterRules().forEach(e -> e.validate()); } + if (networkRuleSets() != null) { + networkRuleSets().validate(); + } if (privateEndpointConnections() != null) { privateEndpointConnections().forEach(e -> e.validate()); } @@ -496,6 +577,12 @@ public void validate() { if (cloudToDevice() != null) { cloudToDevice().validate(); } + if (deviceStreams() != null) { + deviceStreams().validate(); + } + if (encryption() != null) { + encryption().validate(); + } if (locations() != null) { locations().forEach(e -> e.validate()); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.java new file mode 100644 index 000000000000..28bb6f5c29ad --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubPropertiesDeviceStreams.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The device streams properties of iothub. */ +@Fluent +public final class IotHubPropertiesDeviceStreams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IotHubPropertiesDeviceStreams.class); + + /* + * List of Device Streams Endpoints. + */ + @JsonProperty(value = "streamingEndpoints") + private List streamingEndpoints; + + /** + * Get the streamingEndpoints property: List of Device Streams Endpoints. + * + * @return the streamingEndpoints value. + */ + public List streamingEndpoints() { + return this.streamingEndpoints; + } + + /** + * Set the streamingEndpoints property: List of Device Streams Endpoints. + * + * @param streamingEndpoints the streamingEndpoints value to set. + * @return the IotHubPropertiesDeviceStreams object itself. + */ + public IotHubPropertiesDeviceStreams withStreamingEndpoints(List streamingEndpoints) { + this.streamingEndpoints = streamingEndpoints; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java index e0f59905c862..7508b995a125 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/IotHubResources.java @@ -230,39 +230,6 @@ EventHubConsumerGroupInfo getEventHubConsumerGroup( Response getEventHubConsumerGroupWithResponse( String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); - /** - * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to add. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by - * server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of the EventHubConsumerGroupInfo object. - */ - EventHubConsumerGroupInfo createEventHubConsumerGroup( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name); - - /** - * Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. - * - * @param resourceGroupName The name of the resource group that contains the IoT hub. - * @param resourceName The name of the IoT hub. - * @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. - * @param name The name of the consumer group to add. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by - * server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the properties of the EventHubConsumerGroupInfo object. - */ - Response createEventHubConsumerGroupWithResponse( - String resourceGroupName, String resourceName, String eventHubEndpointName, String name, Context context); - /** * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. * @@ -657,6 +624,31 @@ Response importDevicesWithResponse( */ Response getByIdWithResponse(String id, Context context); + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + EventHubConsumerGroupInfo getEventHubConsumerGroupById(String id); + + /** + * Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + * + * @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.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + */ + Response getEventHubConsumerGroupByIdWithResponse(String id, Context context); + /** * Delete an IoT hub. * @@ -682,6 +674,30 @@ Response importDevicesWithResponse( */ IotHubDescription deleteByIdWithResponse(String id, Context context); + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.iothub.models.ErrorDetailsException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteEventHubConsumerGroupById(String id); + + /** + * Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + * + * @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.resourcemanager.iothub.models.ErrorDetailsException 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. + */ + Response deleteEventHubConsumerGroupByIdWithResponse(String id, Context context); + /** * Begins definition for a new IotHubDescription resource. * @@ -689,4 +705,12 @@ Response importDevicesWithResponse( * @return the first stage of the new IotHubDescription definition. */ IotHubDescription.DefinitionStages.Blank define(String name); + + /** + * Begins definition for a new EventHubConsumerGroupInfo resource. + * + * @param name resource name. + * @return the first stage of the new EventHubConsumerGroupInfo definition. + */ + EventHubConsumerGroupInfo.DefinitionStages.Blank defineEventHubConsumerGroup(String name); } diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java new file mode 100644 index 000000000000..1e5461f8ca53 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/KeyVaultKeyProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the KeyVault key. */ +@Fluent +public final class KeyVaultKeyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultKeyProperties.class); + + /* + * The identifier of the key. + */ + @JsonProperty(value = "keyIdentifier") + private String keyIdentifier; + + /* + * Managed identity properties of KeyVault Key. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + + /** + * Get the keyIdentifier property: The identifier of the key. + * + * @return the keyIdentifier value. + */ + public String keyIdentifier() { + return this.keyIdentifier; + } + + /** + * Set the keyIdentifier property: The identifier of the key. + * + * @param keyIdentifier the keyIdentifier value to set. + * @return the KeyVaultKeyProperties object itself. + */ + public KeyVaultKeyProperties withKeyIdentifier(String keyIdentifier) { + this.keyIdentifier = keyIdentifier; + return this; + } + + /** + * Get the identity property: Managed identity properties of KeyVault Key. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of KeyVault Key. + * + * @param identity the identity value to set. + * @return the KeyVaultKeyProperties object itself. + */ + public KeyVaultKeyProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ManagedIdentity.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ManagedIdentity.java new file mode 100644 index 000000000000..1ccf0db4f1f9 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ManagedIdentity.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.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the Managed identity. */ +@Fluent +public class ManagedIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedIdentity.class); + + /* + * The user assigned identity. + */ + @JsonProperty(value = "userAssignedIdentity") + private String userAssignedIdentity; + + /** + * Get the userAssignedIdentity property: The user assigned identity. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The user assigned identity. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the ManagedIdentity object itself. + */ + public ManagedIdentity withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.java new file mode 100644 index 000000000000..1f4cf94b56ba --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleIpAction.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NetworkRuleIpAction. */ +public final class NetworkRuleIpAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleIpAction. */ + public static final NetworkRuleIpAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a NetworkRuleIpAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkRuleIpAction. + */ + @JsonCreator + public static NetworkRuleIpAction fromString(String name) { + return fromString(name, NetworkRuleIpAction.class); + } + + /** @return known NetworkRuleIpAction values. */ + public static Collection values() { + return values(NetworkRuleIpAction.class); + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java new file mode 100644 index 000000000000..420a12f6ab9f --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetIpRule.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IP Rule to be applied as part of Network Rule Set. */ +@Fluent +public final class NetworkRuleSetIpRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSetIpRule.class); + + /* + * Name of the IP filter rule. + */ + @JsonProperty(value = "filterName", required = true) + private String filterName; + + /* + * IP Filter Action + */ + @JsonProperty(value = "action") + private NetworkRuleIpAction action; + + /* + * A string that contains the IP address range in CIDR notation for the + * rule. + */ + @JsonProperty(value = "ipMask", required = true) + private String ipMask; + + /** + * Get the filterName property: Name of the IP filter rule. + * + * @return the filterName value. + */ + public String filterName() { + return this.filterName; + } + + /** + * Set the filterName property: Name of the IP filter rule. + * + * @param filterName the filterName value to set. + * @return the NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withFilterName(String filterName) { + this.filterName = filterName; + return this; + } + + /** + * Get the action property: IP Filter Action. + * + * @return the action value. + */ + public NetworkRuleIpAction action() { + return this.action; + } + + /** + * Set the action property: IP Filter Action. + * + * @param action the action value to set. + * @return the NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withAction(NetworkRuleIpAction action) { + this.action = action; + return this; + } + + /** + * Get the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @return the ipMask value. + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set the ipMask property: A string that contains the IP address range in CIDR notation for the rule. + * + * @param ipMask the ipMask value to set. + * @return the NetworkRuleSetIpRule object itself. + */ + public NetworkRuleSetIpRule withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filterName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property filterName in model NetworkRuleSetIpRule")); + } + if (ipMask() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ipMask in model NetworkRuleSetIpRule")); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.java new file mode 100644 index 000000000000..7121e4d7c4d0 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/NetworkRuleSetProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iothub.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network Rule Set Properties of IotHub. */ +@Fluent +public final class NetworkRuleSetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSetProperties.class); + + /* + * Default Action for Network Rule Set + */ + @JsonProperty(value = "defaultAction") + private DefaultAction defaultAction; + + /* + * If True, then Network Rule Set is also applied to BuiltIn EventHub + * EndPoint of IotHub + */ + @JsonProperty(value = "applyToBuiltInEventHubEndpoint", required = true) + private boolean applyToBuiltInEventHubEndpoint; + + /* + * List of IP Rules + */ + @JsonProperty(value = "ipRules", required = true) + private List ipRules; + + /** + * Get the defaultAction property: Default Action for Network Rule Set. + * + * @return the defaultAction value. + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction property: Default Action for Network Rule Set. + * + * @param defaultAction the defaultAction value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the applyToBuiltInEventHubEndpoint property: If True, then Network Rule Set is also applied to BuiltIn + * EventHub EndPoint of IotHub. + * + * @return the applyToBuiltInEventHubEndpoint value. + */ + public boolean applyToBuiltInEventHubEndpoint() { + return this.applyToBuiltInEventHubEndpoint; + } + + /** + * Set the applyToBuiltInEventHubEndpoint property: If True, then Network Rule Set is also applied to BuiltIn + * EventHub EndPoint of IotHub. + * + * @param applyToBuiltInEventHubEndpoint the applyToBuiltInEventHubEndpoint value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withApplyToBuiltInEventHubEndpoint(boolean applyToBuiltInEventHubEndpoint) { + this.applyToBuiltInEventHubEndpoint = applyToBuiltInEventHubEndpoint; + return this; + } + + /** + * Get the ipRules property: List of IP Rules. + * + * @return the ipRules value. + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules property: List of IP Rules. + * + * @param ipRules the ipRules value to set. + * @return the NetworkRuleSetProperties object itself. + */ + public NetworkRuleSetProperties withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipRules() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ipRules in model NetworkRuleSetProperties")); + } else { + ipRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.java new file mode 100644 index 000000000000..c7beca944286 --- /dev/null +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/ResourceIdentityType.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.iothub.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java index 857d7ac7bf29..235e904a445c 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingEventHubProperties.java @@ -44,6 +44,12 @@ public final class RoutingEventHubProperties { @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; + /* + * Managed identity properties of routing event hub endpoint. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + /* * The name that identifies this endpoint. The name can only include * alphanumeric characters, periods, underscores, hyphens and has a maximum @@ -166,6 +172,26 @@ public RoutingEventHubProperties withAuthenticationType(AuthenticationType authe return this; } + /** + * Get the identity property: Managed identity properties of routing event hub endpoint. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of routing event hub endpoint. + * + * @param identity the identity value to set. + * @return the RoutingEventHubProperties object itself. + */ + public RoutingEventHubProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: @@ -236,6 +262,9 @@ public RoutingEventHubProperties withResourceGroup(String resourceGroup) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java index 0e53f5ec5b88..3736dc3a2a26 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusQueueEndpointProperties.java @@ -45,6 +45,12 @@ public final class RoutingServiceBusQueueEndpointProperties { @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; + /* + * Managed identity properties of routing service bus queue endpoint. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + /* * The name that identifies this endpoint. The name can only include * alphanumeric characters, periods, underscores, hyphens and has a maximum @@ -167,6 +173,26 @@ public RoutingServiceBusQueueEndpointProperties withAuthenticationType(Authentic return this; } + /** + * Get the identity property: Managed identity properties of routing service bus queue endpoint. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of routing service bus queue endpoint. + * + * @param identity the identity value to set. + * @return the RoutingServiceBusQueueEndpointProperties object itself. + */ + public RoutingServiceBusQueueEndpointProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: @@ -239,6 +265,9 @@ public RoutingServiceBusQueueEndpointProperties withResourceGroup(String resourc * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java index c3585aedea7d..190b697a5b82 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingServiceBusTopicEndpointProperties.java @@ -45,6 +45,12 @@ public final class RoutingServiceBusTopicEndpointProperties { @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; + /* + * Managed identity properties of routing service bus topic endpoint. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + /* * The name that identifies this endpoint. The name can only include * alphanumeric characters, periods, underscores, hyphens and has a maximum @@ -167,6 +173,26 @@ public RoutingServiceBusTopicEndpointProperties withAuthenticationType(Authentic return this; } + /** + * Get the identity property: Managed identity properties of routing service bus topic endpoint. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of routing service bus topic endpoint. + * + * @param identity the identity value to set. + * @return the RoutingServiceBusTopicEndpointProperties object itself. + */ + public RoutingServiceBusTopicEndpointProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: @@ -239,6 +265,9 @@ public RoutingServiceBusTopicEndpointProperties withResourceGroup(String resourc * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java index 092fb58842a2..3a155d6f59ea 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingSource.java @@ -25,6 +25,12 @@ public final class RoutingSource extends ExpandableStringEnum { /** Static value DeviceJobLifecycleEvents for RoutingSource. */ public static final RoutingSource DEVICE_JOB_LIFECYCLE_EVENTS = fromString("DeviceJobLifecycleEvents"); + /** Static value DigitalTwinChangeEvents for RoutingSource. */ + public static final RoutingSource DIGITAL_TWIN_CHANGE_EVENTS = fromString("DigitalTwinChangeEvents"); + + /** Static value DeviceConnectionStateEvents for RoutingSource. */ + public static final RoutingSource DEVICE_CONNECTION_STATE_EVENTS = fromString("DeviceConnectionStateEvents"); + /** * Creates or finds a RoutingSource from its string representation. * diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java index fe75186ae836..1221f96c48dd 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/RoutingStorageContainerProperties.java @@ -38,6 +38,12 @@ public final class RoutingStorageContainerProperties { @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; + /* + * Managed identity properties of routing storage endpoint. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + /* * The name that identifies this endpoint. The name can only include * alphanumeric characters, periods, underscores, hyphens and has a maximum @@ -176,6 +182,26 @@ public RoutingStorageContainerProperties withAuthenticationType(AuthenticationTy return this; } + /** + * Get the identity property: Managed identity properties of routing storage endpoint. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of routing storage endpoint. + * + * @param identity the identity value to set. + * @return the RoutingStorageContainerProperties object itself. + */ + public RoutingStorageContainerProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the name property: The name that identifies this endpoint. The name can only include alphanumeric characters, * periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: @@ -354,6 +380,9 @@ public RoutingStorageContainerProperties withEncoding(RoutingStorageContainerPro * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (identity() != null) { + identity().validate(); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java index 56b8560b35c5..bc0000316554 100644 --- a/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java +++ b/sdk/iothub/azure-resourcemanager-iothub/src/main/java/com/azure/resourcemanager/iothub/models/StorageEndpointProperties.java @@ -45,6 +45,12 @@ public final class StorageEndpointProperties { @JsonProperty(value = "authenticationType") private AuthenticationType authenticationType; + /* + * Managed identity properties of storage endpoint for file upload. + */ + @JsonProperty(value = "identity") + private ManagedIdentity identity; + /** * Get the sasTtlAsIso8601 property: The period of time for which the SAS URI generated by IoT Hub for file upload * is valid. See: @@ -135,6 +141,26 @@ public StorageEndpointProperties withAuthenticationType(AuthenticationType authe return this; } + /** + * Get the identity property: Managed identity properties of storage endpoint for file upload. + * + * @return the identity value. + */ + public ManagedIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity properties of storage endpoint for file upload. + * + * @param identity the identity value to set. + * @return the StorageEndpointProperties object itself. + */ + public StorageEndpointProperties withIdentity(ManagedIdentity identity) { + this.identity = identity; + return this; + } + /** * Validates the instance. * @@ -153,5 +179,8 @@ public void validate() { new IllegalArgumentException( "Missing required property containerName in model StorageEndpointProperties")); } + if (identity() != null) { + identity().validate(); + } } }