|
| 1 | +# Code snippets and samples |
| 2 | + |
| 3 | + |
| 4 | +## Apps |
| 5 | + |
| 6 | +- [CheckNameAvailability](#apps_checknameavailability) |
| 7 | +- [CheckSubdomainAvailability](#apps_checksubdomainavailability) |
| 8 | +- [CreateOrUpdate](#apps_createorupdate) |
| 9 | +- [Delete](#apps_delete) |
| 10 | +- [GetByResourceGroup](#apps_getbyresourcegroup) |
| 11 | +- [List](#apps_list) |
| 12 | +- [ListByResourceGroup](#apps_listbyresourcegroup) |
| 13 | +- [ListTemplates](#apps_listtemplates) |
| 14 | +- [Update](#apps_update) |
| 15 | + |
| 16 | +## Operations |
| 17 | + |
| 18 | +- [List](#operations_list) |
| 19 | +### Apps_CheckNameAvailability |
| 20 | + |
| 21 | +```java |
| 22 | +import com.azure.core.util.Context; |
| 23 | +import com.azure.resourcemanager.iotcentral.models.OperationInputs; |
| 24 | + |
| 25 | +/** Samples for Apps CheckNameAvailability. */ |
| 26 | +public final class AppsCheckNameAvailabilitySamples { |
| 27 | + /* |
| 28 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckNameAvailability.json |
| 29 | + */ |
| 30 | + /** |
| 31 | + * Sample code: Apps_CheckNameAvailability. |
| 32 | + * |
| 33 | + * @param manager Entry point to IotCentralManager. |
| 34 | + */ |
| 35 | + public static void appsCheckNameAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 36 | + manager |
| 37 | + .apps() |
| 38 | + .checkNameAvailabilityWithResponse( |
| 39 | + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); |
| 40 | + } |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +### Apps_CheckSubdomainAvailability |
| 45 | + |
| 46 | +```java |
| 47 | +import com.azure.core.util.Context; |
| 48 | +import com.azure.resourcemanager.iotcentral.models.OperationInputs; |
| 49 | + |
| 50 | +/** Samples for Apps CheckSubdomainAvailability. */ |
| 51 | +public final class AppsCheckSubdomainAvailabilitySamples { |
| 52 | + /* |
| 53 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json |
| 54 | + */ |
| 55 | + /** |
| 56 | + * Sample code: Apps_SubdomainAvailability. |
| 57 | + * |
| 58 | + * @param manager Entry point to IotCentralManager. |
| 59 | + */ |
| 60 | + public static void appsSubdomainAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 61 | + manager |
| 62 | + .apps() |
| 63 | + .checkSubdomainAvailabilityWithResponse( |
| 64 | + new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE); |
| 65 | + } |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Apps_CreateOrUpdate |
| 70 | + |
| 71 | +```java |
| 72 | +import com.azure.resourcemanager.iotcentral.models.AppSku; |
| 73 | +import com.azure.resourcemanager.iotcentral.models.AppSkuInfo; |
| 74 | +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; |
| 75 | +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; |
| 76 | + |
| 77 | +/** Samples for Apps CreateOrUpdate. */ |
| 78 | +public final class AppsCreateOrUpdateSamples { |
| 79 | + /* |
| 80 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CreateOrUpdate.json |
| 81 | + */ |
| 82 | + /** |
| 83 | + * Sample code: Apps_CreateOrUpdate. |
| 84 | + * |
| 85 | + * @param manager Entry point to IotCentralManager. |
| 86 | + */ |
| 87 | + public static void appsCreateOrUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 88 | + manager |
| 89 | + .apps() |
| 90 | + .define("myIoTCentralApp") |
| 91 | + .withRegion("westus") |
| 92 | + .withExistingResourceGroup("resRg") |
| 93 | + .withSku(new AppSkuInfo().withName(AppSku.ST2)) |
| 94 | + .withIdentity( |
| 95 | + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) |
| 96 | + .withDisplayName("My IoT Central App") |
| 97 | + .withSubdomain("my-iot-central-app") |
| 98 | + .withTemplate( "[email protected]") |
| 99 | + .create(); |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +### Apps_Delete |
| 105 | + |
| 106 | +```java |
| 107 | +import com.azure.core.util.Context; |
| 108 | + |
| 109 | +/** Samples for Apps Delete. */ |
| 110 | +public final class AppsDeleteSamples { |
| 111 | + /* |
| 112 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Delete.json |
| 113 | + */ |
| 114 | + /** |
| 115 | + * Sample code: Apps_Delete. |
| 116 | + * |
| 117 | + * @param manager Entry point to IotCentralManager. |
| 118 | + */ |
| 119 | + public static void appsDelete(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 120 | + manager.apps().delete("resRg", "myIoTCentralApp", Context.NONE); |
| 121 | + } |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +### Apps_GetByResourceGroup |
| 126 | + |
| 127 | +```java |
| 128 | +import com.azure.core.util.Context; |
| 129 | + |
| 130 | +/** Samples for Apps GetByResourceGroup. */ |
| 131 | +public final class AppsGetByResourceGroupSamples { |
| 132 | + /* |
| 133 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Get.json |
| 134 | + */ |
| 135 | + /** |
| 136 | + * Sample code: Apps_Get. |
| 137 | + * |
| 138 | + * @param manager Entry point to IotCentralManager. |
| 139 | + */ |
| 140 | + public static void appsGet(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 141 | + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE); |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +### Apps_List |
| 147 | + |
| 148 | +```java |
| 149 | +import com.azure.core.util.Context; |
| 150 | + |
| 151 | +/** Samples for Apps List. */ |
| 152 | +public final class AppsListSamples { |
| 153 | + /* |
| 154 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListBySubscription.json |
| 155 | + */ |
| 156 | + /** |
| 157 | + * Sample code: Apps_ListBySubscription. |
| 158 | + * |
| 159 | + * @param manager Entry point to IotCentralManager. |
| 160 | + */ |
| 161 | + public static void appsListBySubscription(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 162 | + manager.apps().list(Context.NONE); |
| 163 | + } |
| 164 | +} |
| 165 | +``` |
| 166 | + |
| 167 | +### Apps_ListByResourceGroup |
| 168 | + |
| 169 | +```java |
| 170 | +import com.azure.core.util.Context; |
| 171 | + |
| 172 | +/** Samples for Apps ListByResourceGroup. */ |
| 173 | +public final class AppsListByResourceGroupSamples { |
| 174 | + /* |
| 175 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_ListByResourceGroup.json |
| 176 | + */ |
| 177 | + /** |
| 178 | + * Sample code: Apps_ListByResourceGroup. |
| 179 | + * |
| 180 | + * @param manager Entry point to IotCentralManager. |
| 181 | + */ |
| 182 | + public static void appsListByResourceGroup(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 183 | + manager.apps().listByResourceGroup("resRg", Context.NONE); |
| 184 | + } |
| 185 | +} |
| 186 | +``` |
| 187 | + |
| 188 | +### Apps_ListTemplates |
| 189 | + |
| 190 | +```java |
| 191 | +import com.azure.core.util.Context; |
| 192 | + |
| 193 | +/** Samples for Apps ListTemplates. */ |
| 194 | +public final class AppsListTemplatesSamples { |
| 195 | + /* |
| 196 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Templates.json |
| 197 | + */ |
| 198 | + /** |
| 199 | + * Sample code: Apps_ListTemplates. |
| 200 | + * |
| 201 | + * @param manager Entry point to IotCentralManager. |
| 202 | + */ |
| 203 | + public static void appsListTemplates(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 204 | + manager.apps().listTemplates(Context.NONE); |
| 205 | + } |
| 206 | +} |
| 207 | +``` |
| 208 | + |
| 209 | +### Apps_Update |
| 210 | + |
| 211 | +```java |
| 212 | +import com.azure.core.util.Context; |
| 213 | +import com.azure.resourcemanager.iotcentral.models.App; |
| 214 | +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentity; |
| 215 | +import com.azure.resourcemanager.iotcentral.models.SystemAssignedServiceIdentityType; |
| 216 | + |
| 217 | +/** Samples for Apps Update. */ |
| 218 | +public final class AppsUpdateSamples { |
| 219 | + /* |
| 220 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_Update.json |
| 221 | + */ |
| 222 | + /** |
| 223 | + * Sample code: Apps_Update. |
| 224 | + * |
| 225 | + * @param manager Entry point to IotCentralManager. |
| 226 | + */ |
| 227 | + public static void appsUpdate(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 228 | + App resource = |
| 229 | + manager.apps().getByResourceGroupWithResponse("resRg", "myIoTCentralApp", Context.NONE).getValue(); |
| 230 | + resource |
| 231 | + .update() |
| 232 | + .withIdentity( |
| 233 | + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) |
| 234 | + .withDisplayName("My IoT Central App 2") |
| 235 | + .apply(); |
| 236 | + } |
| 237 | +} |
| 238 | +``` |
| 239 | + |
| 240 | +### Operations_List |
| 241 | + |
| 242 | +```java |
| 243 | +import com.azure.core.util.Context; |
| 244 | + |
| 245 | +/** Samples for Operations List. */ |
| 246 | +public final class OperationsListSamples { |
| 247 | + /* |
| 248 | + * x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Operations_List.json |
| 249 | + */ |
| 250 | + /** |
| 251 | + * Sample code: Operations_List. |
| 252 | + * |
| 253 | + * @param manager Entry point to IotCentralManager. |
| 254 | + */ |
| 255 | + public static void operationsList(com.azure.resourcemanager.iotcentral.IotCentralManager manager) { |
| 256 | + manager.operations().list(Context.NONE); |
| 257 | + } |
| 258 | +} |
| 259 | +``` |
| 260 | + |
0 commit comments