diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md b/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md index ea867d29d373..b281c3271e56 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-10-14) +- Azure Resource Manager IotCentral client library for Java. This package contains Microsoft Azure SDK for IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2021-06. 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-04-22) diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md b/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md index c5fc97615835..b8d6f5134302 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/README.md @@ -2,7 +2,7 @@ Azure Resource Manager IotCentral client library for Java. -This package contains Microsoft Azure SDK for IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2018-09-01. 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 IotCentral Management SDK. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2021-06. 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-iotcentral - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/iotcentral/azure-resourcemanager-iotcentral/SAMPLE.md) + + ## Troubleshooting ## Next steps diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/SAMPLE.md b/sdk/iotcentral/azure-resourcemanager-iotcentral/SAMPLE.md new file mode 100644 index 000000000000..fc66b259ac18 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/SAMPLE.md @@ -0,0 +1,260 @@ +# Code snippets and samples + + +## Apps + +- [CheckNameAvailability](#apps_checknameavailability) +- [CheckSubdomainAvailability](#apps_checksubdomainavailability) +- [CreateOrUpdate](#apps_createorupdate) +- [Delete](#apps_delete) +- [GetByResourceGroup](#apps_getbyresourcegroup) +- [List](#apps_list) +- [ListByResourceGroup](#apps_listbyresourcegroup) +- [ListTemplates](#apps_listtemplates) +- [Update](#apps_update) + +## Operations + +- [List](#operations_list) +### Apps_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; + +/** Samples for Apps CheckNameAvailability. */ +public final class AppsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json + */ + /** + * Sample code: Apps_CheckNameAvailability. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsCheckNameAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .checkNameAvailabilityWithResponse( + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); + } +} +``` + +### Apps_CheckSubdomainAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; + +/** Samples for Apps CheckSubdomainAvailability. */ +public final class AppsCheckSubdomainAvailabilitySamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json + */ + /** + * Sample code: Apps_SubdomainAvailability. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsSubdomainAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .checkSubdomainAvailabilityWithResponse( + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); + } +} +``` + +### Apps_CreateOrUpdate + +```java +import com.azure.resourcemanager.iotcentral.models.AppSku; +import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; + +/** Samples for Apps CreateOrUpdate. */ +public final class AppsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CreateOrUpdate.json + */ + /** + * Sample code: Apps_CreateOrUpdate. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsCreateOrUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .define("myIoTCentralApp") + .withRegion("westus") + .withExistingResourceGroup("resRg") + .withSku(new AppSkuInfo().withName(AppSku.ST2)) + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDisplayName("My IoT Central App") + .withSubdomain("my-iot-central-app") + .withTemplate("iotc-pnp-preview@1.0.0") + .create(); + } +} +``` + +### Apps_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Apps Delete. */ +public final class AppsDeleteSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Delete.json + */ + /** + * Sample code: Apps_Delete. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsDelete(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().delete("resRg", "myIoTCentralApp", Context.NONE); + } +} +``` + +### Apps_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Apps GetByResourceGroup. */ +public final class AppsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Get.json + */ + /** + * Sample code: Apps_Get. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsGet(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE); + } +} +``` + +### Apps_List + +```java +import com.azure.core.util.Context; + +/** Samples for Apps List. */ +public final class AppsListSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListBySubscription.json + */ + /** + * Sample code: Apps_ListBySubscription. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListBySubscription(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().list(Context.NONE); + } +} +``` + +### Apps_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Apps ListByResourceGroup. */ +public final class AppsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListByResourceGroup.json + */ + /** + * Sample code: Apps_ListByResourceGroup. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListByResourceGroup(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().listByResourceGroup("resRg", Context.NONE); + } +} +``` + +### Apps_ListTemplates + +```java +import com.azure.core.util.Context; + +/** Samples for Apps ListTemplates. */ +public final class AppsListTemplatesSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Templates.json + */ + /** + * Sample code: Apps_ListTemplates. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListTemplates(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().listTemplates(Context.NONE); + } +} +``` + +### Apps_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.App; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; + +/** Samples for Apps Update. */ +public final class AppsUpdateSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Update.json + */ + /** + * Sample code: Apps_Update. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + App resource = + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE).getValue(); + resource + .update() + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDisplayName("My IoT Central App 2") + .apply(); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to IotCentralManager. + */ + public static void operationsList(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml b/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml index 136d992f3a36..cedf2b06a9d7 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/pom.xml @@ -1,67 +1,86 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-iotcentral - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-iotcentral + 1.0.0-beta.2 + jar - Microsoft Azure SDK for IotCentral Management - This package contains Microsoft Azure SDK for IotCentral Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2018-09-01. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for IotCentral Management + This package contains Microsoft Azure SDK for IotCentral Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Use this API to manage IoT Central Applications in your Azure subscription. Package tag package-2021-06. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core - 1.21.0 - - - com.azure - azure-core-management - 1.4.2 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java index a8b9e5fd9945..92148b0f4aa1 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/IotCentralManager.java @@ -9,7 +9,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +16,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -81,6 +81,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -120,6 +121,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -176,6 +188,9 @@ public IotCentralManager authenticate(TokenCredential credential, AzureProfile p userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } @@ -185,10 +200,7 @@ public IotCentralManager authenticate(TokenCredential credential, AzureProfile p HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java index b4988bc2825a..583a5e83cc45 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/AppsClient.java @@ -59,7 +59,7 @@ public interface AppsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AppInner> beginCreateOrUpdate( String resourceGroupName, String resourceName, AppInner app); @@ -77,7 +77,7 @@ SyncPoller, AppInner> beginCreateOrUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AppInner> beginCreateOrUpdate( String resourceGroupName, String resourceName, AppInner app, Context context); @@ -125,7 +125,7 @@ SyncPoller, AppInner> beginCreateOrUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AppInner> beginUpdate( String resourceGroupName, String resourceName, AppPatch appPatch); @@ -141,7 +141,7 @@ SyncPoller, AppInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, AppInner> beginUpdate( String resourceGroupName, String resourceName, AppPatch appPatch, Context context); @@ -184,7 +184,7 @@ SyncPoller, AppInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName); /** @@ -198,7 +198,7 @@ SyncPoller, AppInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName, Context context); /** diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java index e9f812521472..fb19acfbc3dc 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/OperationsClient.java @@ -13,7 +13,7 @@ /** An instance of this class provides access to all the operations defined in OperationsClient. */ public interface OperationsClient { /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -23,7 +23,7 @@ public interface OperationsClient { PagedIterable list(); /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java index 2955e20bd3b3..f9d25554703a 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppInner.java @@ -5,52 +5,46 @@ package com.azure.resourcemanager.iotcentral.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import com.azure.resourcemanager.iotcentral.models.AppState; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** The IoT Central application. */ -@JsonFlatten @Fluent -public class AppInner extends Resource { +public final class AppInner extends Resource { @JsonIgnore private final ClientLogger logger = new ClientLogger(AppInner.class); /* - * A valid instance SKU. - */ - @JsonProperty(value = "sku", required = true) - private AppSkuInfo sku; - - /* - * The ID of the application. + * The common properties of an IoT Central application. */ - @JsonProperty(value = "properties.applicationId", access = JsonProperty.Access.WRITE_ONLY) - private String applicationId; + @JsonProperty(value = "properties") + private AppProperties innerProperties; /* - * The display name of the application. + * A valid instance SKU. */ - @JsonProperty(value = "properties.displayName") - private String displayName; + @JsonProperty(value = "sku", required = true) + private AppSkuInfo sku; /* - * The subdomain of the application. + * The managed identities for the IoT Central application. */ - @JsonProperty(value = "properties.subdomain") - private String subdomain; + @JsonProperty(value = "identity") + private SystemAssignedServiceIdentity identity; - /* - * The ID of the application template, which is a blueprint that defines - * the characteristics and behaviors of an application. Optional; if not - * specified, defaults to a blank blueprint and allows the application to - * be defined from scratch. + /** + * Get the innerProperties property: The common properties of an IoT Central application. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.template") - private String template; + private AppProperties innerProperties() { + return this.innerProperties; + } /** * Get the sku property: A valid instance SKU. @@ -72,13 +66,47 @@ public AppInner withSku(AppSkuInfo sku) { return this; } + /** + * Get the identity property: The managed identities for the IoT Central application. + * + * @return the identity value. + */ + public SystemAssignedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identities for the IoT Central application. + * + * @param identity the identity value to set. + * @return the AppInner object itself. + */ + public AppInner withIdentity(SystemAssignedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public AppInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AppInner withTags(Map tags) { + super.withTags(tags); + return this; + } + /** * Get the applicationId property: The ID of the application. * * @return the applicationId value. */ public String applicationId() { - return this.applicationId; + return this.innerProperties() == null ? null : this.innerProperties().applicationId(); } /** @@ -87,7 +115,7 @@ public String applicationId() { * @return the displayName value. */ public String displayName() { - return this.displayName; + return this.innerProperties() == null ? null : this.innerProperties().displayName(); } /** @@ -97,7 +125,10 @@ public String displayName() { * @return the AppInner object itself. */ public AppInner withDisplayName(String displayName) { - this.displayName = displayName; + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withDisplayName(displayName); return this; } @@ -107,7 +138,7 @@ public AppInner withDisplayName(String displayName) { * @return the subdomain value. */ public String subdomain() { - return this.subdomain; + return this.innerProperties() == null ? null : this.innerProperties().subdomain(); } /** @@ -117,7 +148,10 @@ public String subdomain() { * @return the AppInner object itself. */ public AppInner withSubdomain(String subdomain) { - this.subdomain = subdomain; + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withSubdomain(subdomain); return this; } @@ -129,7 +163,7 @@ public AppInner withSubdomain(String subdomain) { * @return the template value. */ public String template() { - return this.template; + return this.innerProperties() == null ? null : this.innerProperties().template(); } /** @@ -141,22 +175,20 @@ public String template() { * @return the AppInner object itself. */ public AppInner withTemplate(String template) { - this.template = template; - return this; - } - - /** {@inheritDoc} */ - @Override - public AppInner withLocation(String location) { - super.withLocation(location); + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withTemplate(template); return this; } - /** {@inheritDoc} */ - @Override - public AppInner withTags(Map tags) { - super.withTags(tags); - return this; + /** + * Get the state property: The current state of the application. + * + * @return the state value. + */ + public AppState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); } /** @@ -165,11 +197,17 @@ public AppInner withTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } if (sku() == null) { throw logger .logExceptionAsError(new IllegalArgumentException("Missing required property sku in model AppInner")); } else { sku().validate(); } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppProperties.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppProperties.java new file mode 100644 index 000000000000..5b29ec381f69 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/fluent/models/AppProperties.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.models.AppState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an IoT Central application. */ +@Fluent +public final class AppProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppProperties.class); + + /* + * The ID of the application. + */ + @JsonProperty(value = "applicationId", access = JsonProperty.Access.WRITE_ONLY) + private String applicationId; + + /* + * The display name of the application. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The subdomain of the application. + */ + @JsonProperty(value = "subdomain") + private String subdomain; + + /* + * The ID of the application template, which is a blueprint that defines + * the characteristics and behaviors of an application. Optional; if not + * specified, defaults to a blank blueprint and allows the application to + * be defined from scratch. + */ + @JsonProperty(value = "template") + private String template; + + /* + * The current state of the application. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private AppState state; + + /** + * Get the applicationId property: The ID of the application. + * + * @return the applicationId value. + */ + public String applicationId() { + return this.applicationId; + } + + /** + * Get the displayName property: The display name of the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the application. + * + * @param displayName the displayName value to set. + * @return the AppProperties object itself. + */ + public AppProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the subdomain property: The subdomain of the application. + * + * @return the subdomain value. + */ + public String subdomain() { + return this.subdomain; + } + + /** + * Set the subdomain property: The subdomain of the application. + * + * @param subdomain the subdomain value to set. + * @return the AppProperties object itself. + */ + public AppProperties withSubdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Get the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @return the template value. + */ + public String template() { + return this.template; + } + + /** + * Set the template property: The ID of the application template, which is a blueprint that defines the + * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and + * allows the application to be defined from scratch. + * + * @param template the template value to set. + * @return the AppProperties object itself. + */ + public AppProperties withTemplate(String template) { + this.template = template; + return this; + } + + /** + * Get the state property: The current state of the application. + * + * @return the state value. + */ + public AppState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java index 2c4ba267c739..74eaa77cea05 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppImpl.java @@ -10,6 +10,8 @@ import com.azure.resourcemanager.iotcentral.models.App; import com.azure.resourcemanager.iotcentral.models.AppPatch; import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import com.azure.resourcemanager.iotcentral.models.AppState; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; import java.util.Collections; import java.util.Map; @@ -47,6 +49,10 @@ public AppSkuInfo sku() { return this.innerModel().sku(); } + public SystemAssignedServiceIdentity identity() { + return this.innerModel().identity(); + } + public String applicationId() { return this.innerModel().applicationId(); } @@ -63,6 +69,10 @@ public String template() { return this.innerModel().template(); } + public AppState state() { + return this.innerModel().state(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -191,6 +201,16 @@ public AppImpl withTags(Map tags) { } } + public AppImpl withIdentity(SystemAssignedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateAppPatch.withIdentity(identity); + return this; + } + } + public AppImpl withDisplayName(String displayName) { if (isInCreateMode()) { this.innerModel().withDisplayName(displayName); @@ -212,13 +232,8 @@ public AppImpl withSubdomain(String subdomain) { } public AppImpl withTemplate(String template) { - if (isInCreateMode()) { - this.innerModel().withTemplate(template); - return this; - } else { - this.updateAppPatch.withTemplate(template); - return this; - } + this.innerModel().withTemplate(template); + return this; } private boolean isInCreateMode() { diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java index 98af831a4b58..ccd794e425e2 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/AppsClientImpl.java @@ -499,7 +499,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AppInner> beginCreateOrUpdateAsync( String resourceGroupName, String resourceName, AppInner app) { Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, resourceName, app); @@ -523,7 +523,7 @@ private PollerFlux, AppInner> beginCreateOrUpdateAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AppInner> beginCreateOrUpdateAsync( String resourceGroupName, String resourceName, AppInner app, Context context) { context = this.client.mergeContext(context); @@ -548,7 +548,7 @@ private PollerFlux, AppInner> beginCreateOrUpdateAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AppInner> beginCreateOrUpdate( String resourceGroupName, String resourceName, AppInner app) { return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app).getSyncPoller(); @@ -568,7 +568,7 @@ public SyncPoller, AppInner> beginCreateOrUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AppInner> beginCreateOrUpdate( String resourceGroupName, String resourceName, AppInner app, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, resourceName, app, context).getSyncPoller(); @@ -772,7 +772,7 @@ private Mono>> updateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AppInner> beginUpdateAsync( String resourceGroupName, String resourceName, AppPatch appPatch) { Mono>> mono = updateWithResponseAsync(resourceGroupName, resourceName, appPatch); @@ -794,7 +794,7 @@ private PollerFlux, AppInner> beginUpdateAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AppInner> beginUpdateAsync( String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { context = this.client.mergeContext(context); @@ -817,7 +817,7 @@ private PollerFlux, AppInner> beginUpdateAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AppInner> beginUpdate( String resourceGroupName, String resourceName, AppPatch appPatch) { return beginUpdateAsync(resourceGroupName, resourceName, appPatch).getSyncPoller(); @@ -835,7 +835,7 @@ public SyncPoller, AppInner> beginUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the IoT Central application. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AppInner> beginUpdate( String resourceGroupName, String resourceName, AppPatch appPatch, Context context) { return beginUpdateAsync(resourceGroupName, resourceName, appPatch, context).getSyncPoller(); @@ -1015,7 +1015,7 @@ private Mono>> deleteWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); return this @@ -1034,7 +1034,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String resourceName, Context context) { context = this.client.mergeContext(context); @@ -1054,7 +1054,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); } @@ -1070,7 +1070,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String resourceName, Context context) { return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java index 0d50c3b944a1..28294e8e2e3e 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/IotCentralClientImpl.java @@ -157,7 +157,7 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2018-09-01"; + this.apiVersion = "2021-06-01"; this.apps = new AppsClientImpl(this); this.operations = new OperationsClientImpl(this); } diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java index b4f59e54f4c1..9b34a05ad0a6 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/implementation/OperationsClientImpl.java @@ -81,7 +81,7 @@ Mono> listNext( } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -112,7 +112,7 @@ private Mono> listSinglePageAsync() { } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -144,7 +144,7 @@ private Mono> listSinglePageAsync(Context context) } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -156,7 +156,7 @@ private PagedFlux listAsync() { } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -171,7 +171,7 @@ private PagedFlux listAsync(Context context) { } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -183,7 +183,7 @@ public PagedIterable list() { } /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java index b76936f50df1..ae3884f769f8 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/App.java @@ -53,6 +53,13 @@ public interface App { */ AppSkuInfo sku(); + /** + * Gets the identity property: The managed identities for the IoT Central application. + * + * @return the identity value. + */ + SystemAssignedServiceIdentity identity(); + /** * Gets the applicationId property: The ID of the application. * @@ -83,6 +90,13 @@ public interface App { */ String template(); + /** + * Gets the state property: The current state of the application. + * + * @return the state value. + */ + AppState state(); + /** * Gets the region of the resource. * @@ -161,6 +175,7 @@ interface WithSku { */ interface WithCreate extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, DefinitionStages.WithDisplayName, DefinitionStages.WithSubdomain, DefinitionStages.WithTemplate { @@ -189,6 +204,16 @@ interface WithTags { */ WithCreate withTags(Map tags); } + /** The stage of the App definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed identities for the IoT Central application.. + * + * @param identity The managed identities for the IoT Central application. + * @return the next definition stage. + */ + WithCreate withIdentity(SystemAssignedServiceIdentity identity); + } /** The stage of the App definition allowing to specify displayName. */ interface WithDisplayName { /** @@ -235,9 +260,9 @@ interface WithTemplate { interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, + UpdateStages.WithIdentity, UpdateStages.WithDisplayName, - UpdateStages.WithSubdomain, - UpdateStages.WithTemplate { + UpdateStages.WithSubdomain { /** * Executes the update request. * @@ -275,6 +300,16 @@ interface WithSku { */ Update withSku(AppSkuInfo sku); } + /** The stage of the App update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed identities for the IoT Central application.. + * + * @param identity The managed identities for the IoT Central application. + * @return the next definition stage. + */ + Update withIdentity(SystemAssignedServiceIdentity identity); + } /** The stage of the App update allowing to specify displayName. */ interface WithDisplayName { /** @@ -295,20 +330,6 @@ interface WithSubdomain { */ Update withSubdomain(String subdomain); } - /** The stage of the App update allowing to specify template. */ - interface WithTemplate { - /** - * Specifies the template property: The ID of the application template, which is a blueprint that defines - * the characteristics and behaviors of an application. Optional; if not specified, defaults to a blank - * blueprint and allows the application to be defined from scratch.. - * - * @param template The ID of the application template, which is a blueprint that defines the characteristics - * and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and allows - * the application to be defined from scratch. - * @return the next definition stage. - */ - Update withTemplate(String template); - } } /** * Refreshes the resource to sync with Azure. diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java index c5d7e4a9639f..7e24be92770d 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppPatch.java @@ -5,22 +5,23 @@ package com.azure.resourcemanager.iotcentral.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.iotcentral.fluent.models.AppProperties; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** The description of the IoT Central application. */ -@JsonFlatten @Fluent -public class AppPatch { +public final class AppPatch { @JsonIgnore private final ClientLogger logger = new ClientLogger(AppPatch.class); /* * Instance tags */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /* @@ -30,31 +31,16 @@ public class AppPatch { private AppSkuInfo sku; /* - * The ID of the application. + * The common properties of an IoT Central application. */ - @JsonProperty(value = "properties.applicationId", access = JsonProperty.Access.WRITE_ONLY) - private String applicationId; + @JsonProperty(value = "properties") + private AppProperties innerProperties; /* - * The display name of the application. + * The managed identities for the IoT Central application. */ - @JsonProperty(value = "properties.displayName") - private String displayName; - - /* - * The subdomain of the application. - */ - @JsonProperty(value = "properties.subdomain") - private String subdomain; - - /* - * The ID of the application template, which is a blueprint that defines - * the characteristics and behaviors of an application. Optional; if not - * specified, defaults to a blank blueprint and allows the application to - * be defined from scratch. - */ - @JsonProperty(value = "properties.template") - private String template; + @JsonProperty(value = "identity") + private SystemAssignedServiceIdentity identity; /** * Get the tags property: Instance tags. @@ -96,13 +82,42 @@ public AppPatch withSku(AppSkuInfo sku) { return this; } + /** + * Get the innerProperties property: The common properties of an IoT Central application. + * + * @return the innerProperties value. + */ + private AppProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The managed identities for the IoT Central application. + * + * @return the identity value. + */ + public SystemAssignedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed identities for the IoT Central application. + * + * @param identity the identity value to set. + * @return the AppPatch object itself. + */ + public AppPatch withIdentity(SystemAssignedServiceIdentity identity) { + this.identity = identity; + return this; + } + /** * Get the applicationId property: The ID of the application. * * @return the applicationId value. */ public String applicationId() { - return this.applicationId; + return this.innerProperties() == null ? null : this.innerProperties().applicationId(); } /** @@ -111,7 +126,7 @@ public String applicationId() { * @return the displayName value. */ public String displayName() { - return this.displayName; + return this.innerProperties() == null ? null : this.innerProperties().displayName(); } /** @@ -121,7 +136,10 @@ public String displayName() { * @return the AppPatch object itself. */ public AppPatch withDisplayName(String displayName) { - this.displayName = displayName; + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withDisplayName(displayName); return this; } @@ -131,7 +149,7 @@ public AppPatch withDisplayName(String displayName) { * @return the subdomain value. */ public String subdomain() { - return this.subdomain; + return this.innerProperties() == null ? null : this.innerProperties().subdomain(); } /** @@ -141,7 +159,10 @@ public String subdomain() { * @return the AppPatch object itself. */ public AppPatch withSubdomain(String subdomain) { - this.subdomain = subdomain; + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withSubdomain(subdomain); return this; } @@ -153,7 +174,7 @@ public AppPatch withSubdomain(String subdomain) { * @return the template value. */ public String template() { - return this.template; + return this.innerProperties() == null ? null : this.innerProperties().template(); } /** @@ -165,10 +186,22 @@ public String template() { * @return the AppPatch object itself. */ public AppPatch withTemplate(String template) { - this.template = template; + if (this.innerProperties() == null) { + this.innerProperties = new AppProperties(); + } + this.innerProperties().withTemplate(template); return this; } + /** + * Get the state property: The current state of the application. + * + * @return the state value. + */ + public AppState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + /** * Validates the instance. * @@ -178,5 +211,11 @@ public void validate() { if (sku() != null) { sku().validate(); } + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } } } diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java index c379395ff5a3..0a45b2ae0772 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppSku.java @@ -10,12 +10,6 @@ /** Defines values for AppSku. */ public final class AppSku extends ExpandableStringEnum { - /** Static value F1 for AppSku. */ - public static final AppSku F1 = fromString("F1"); - - /** Static value S1 for AppSku. */ - public static final AppSku S1 = fromString("S1"); - /** Static value ST0 for AppSku. */ public static final AppSku ST0 = fromString("ST0"); diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppState.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppState.java new file mode 100644 index 000000000000..d339243ae80c --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/AppState.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.iotcentral.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AppState. */ +public final class AppState extends ExpandableStringEnum { + /** Static value created for AppState. */ + public static final AppState CREATED = fromString("created"); + + /** Static value suspended for AppState. */ + public static final AppState SUSPENDED = fromString("suspended"); + + /** + * Creates or finds a AppState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AppState. + */ + @JsonCreator + public static AppState fromString(String name) { + return fromString(name, AppState.class); + } + + /** @return known AppState values. */ + public static Collection values() { + return values(AppState.class); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.java deleted file mode 100644 index 006e23fd3136..000000000000 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/CloudErrorBody.java +++ /dev/null @@ -1,99 +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.iotcentral.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; - -/** Details of error response. */ -@Fluent -public final class CloudErrorBody { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudErrorBody.class); - - /* - * The error code. - */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) - private String code; - - /* - * The error message. - */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) - private String message; - - /* - * The target of the particular error. - */ - @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) - private String target; - - /* - * A list of additional details about the error. - */ - @JsonProperty(value = "details") - private List details; - - /** - * Get the code property: The error code. - * - * @return the code value. - */ - public String code() { - return this.code; - } - - /** - * Get the message property: The error message. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Get the target property: The target of the particular error. - * - * @return the target value. - */ - public String target() { - return this.target; - } - - /** - * Get the details property: A list of additional details about the error. - * - * @return the details value. - */ - public List details() { - return this.details; - } - - /** - * Set the details property: A list of additional details about the error. - * - * @param details the details value to set. - * @return the CloudErrorBody object itself. - */ - public CloudErrorBody withDetails(List details) { - this.details = details; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (details() != null) { - details().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java index dd5fcf5ea78f..3ff9abc07d90 100644 --- a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/Operations.java @@ -10,7 +10,7 @@ /** Resource collection API of Operations. */ public interface Operations { /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -19,7 +19,7 @@ public interface Operations { PagedIterable list(); /** - * Lists all of the available IoT Central application REST API operations. + * Lists all of the available IoT Central Resource Provider operations. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentity.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentity.java new file mode 100644 index 000000000000..89341d07b098 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentity.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.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.UUID; + +/** Managed service identity (either system assigned, or none). */ +@Fluent +public class SystemAssignedServiceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemAssignedServiceIdentity.class); + + /* + * The service principal ID of the system assigned identity. This property + * will only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (either system assigned, or none). + */ + @JsonProperty(value = "type", required = true) + private SystemAssignedServiceIdentityType type; + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (either system assigned, or none). + * + * @return the type value. + */ + public SystemAssignedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (either system assigned, or none). + * + * @param type the type value to set. + * @return the SystemAssignedServiceIdentity object itself. + */ + public SystemAssignedServiceIdentity withType(SystemAssignedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model SystemAssignedServiceIdentity")); + } + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentityType.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentityType.java new file mode 100644 index 000000000000..23a276db5589 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/main/java/com/azure/resourcemanager/iotcentral/models/SystemAssignedServiceIdentityType.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.iotcentral.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SystemAssignedServiceIdentityType. */ +public final class SystemAssignedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for SystemAssignedServiceIdentityType. */ + public static final SystemAssignedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for SystemAssignedServiceIdentityType. */ + public static final SystemAssignedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a SystemAssignedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SystemAssignedServiceIdentityType. + */ + @JsonCreator + public static SystemAssignedServiceIdentityType fromString(String name) { + return fromString(name, SystemAssignedServiceIdentityType.class); + } + + /** @return known SystemAssignedServiceIdentityType values. */ + public static Collection values() { + return values(SystemAssignedServiceIdentityType.class); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckNameAvailabilitySamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..dd6585427867 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckNameAvailabilitySamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; + +/** Samples for Apps CheckNameAvailability. */ +public final class AppsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json + */ + /** + * Sample code: Apps_CheckNameAvailability. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsCheckNameAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .checkNameAvailabilityWithResponse( + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckSubdomainAvailabilitySamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckSubdomainAvailabilitySamples.java new file mode 100644 index 000000000000..e508d74a53bf --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCheckSubdomainAvailabilitySamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.OperationInputs; + +/** Samples for Apps CheckSubdomainAvailability. */ +public final class AppsCheckSubdomainAvailabilitySamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json + */ + /** + * Sample code: Apps_SubdomainAvailability. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsSubdomainAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .checkSubdomainAvailabilityWithResponse( + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCreateOrUpdateSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..52a25f77ed12 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.resourcemanager.iotcentral.models.AppSku; +import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; + +/** Samples for Apps CreateOrUpdate. */ +public final class AppsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CreateOrUpdate.json + */ + /** + * Sample code: Apps_CreateOrUpdate. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsCreateOrUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager + .apps() + .define("myIoTCentralApp") + .withRegion("westus") + .withExistingResourceGroup("resRg") + .withSku(new AppSkuInfo().withName(AppSku.ST2)) + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDisplayName("My IoT Central App") + .withSubdomain("my-iot-central-app") + .withTemplate("iotc-pnp-preview@1.0.0") + .create(); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsDeleteSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsDeleteSamples.java new file mode 100644 index 000000000000..98bf4780276b --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Apps Delete. */ +public final class AppsDeleteSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Delete.json + */ + /** + * Sample code: Apps_Delete. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsDelete(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().delete("resRg", "myIoTCentralApp", Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsGetByResourceGroupSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..f446d0e4db69 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Apps GetByResourceGroup. */ +public final class AppsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Get.json + */ + /** + * Sample code: Apps_Get. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsGet(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListByResourceGroupSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListByResourceGroupSamples.java new file mode 100644 index 000000000000..858188f06aa1 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Apps ListByResourceGroup. */ +public final class AppsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListByResourceGroup.json + */ + /** + * Sample code: Apps_ListByResourceGroup. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListByResourceGroup(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().listByResourceGroup("resRg", Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListSamples.java new file mode 100644 index 000000000000..f406fe95a57d --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Apps List. */ +public final class AppsListSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListBySubscription.json + */ + /** + * Sample code: Apps_ListBySubscription. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListBySubscription(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().list(Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListTemplatesSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListTemplatesSamples.java new file mode 100644 index 000000000000..e85776f9f0ab --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsListTemplatesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Apps ListTemplates. */ +public final class AppsListTemplatesSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Templates.json + */ + /** + * Sample code: Apps_ListTemplates. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsListTemplates(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.apps().listTemplates(Context.NONE); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsUpdateSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsUpdateSamples.java new file mode 100644 index 000000000000..83069eab00bf --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/AppsUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.iotcentral.models.App; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; + +/** Samples for Apps Update. */ +public final class AppsUpdateSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Update.json + */ + /** + * Sample code: Apps_Update. + * + * @param manager Entry point to IotCentralManager. + */ + public static void appsUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + App resource = + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE).getValue(); + resource + .update() + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) + .withDisplayName("My IoT Central App 2") + .apply(); + } +} diff --git a/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/OperationsListSamples.java b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/OperationsListSamples.java new file mode 100644 index 000000000000..04585900c893 --- /dev/null +++ b/sdk/iotcentral/azure-resourcemanager-iotcentral/src/samples/java/com/azure/resourcemanager/iotcentral/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.iotcentral.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to IotCentralManager. + */ + public static void operationsList(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { + manager.operations().list(Context.NONE); + } +}