|
| 1 | +# Code snippets and samples |
| 2 | + |
| 3 | + |
| 4 | +## Employees |
| 5 | + |
| 6 | +- [CreateOrUpdate](#employees_createorupdate) |
| 7 | +- [Delete](#employees_delete) |
| 8 | +- [GetByResourceGroup](#employees_getbyresourcegroup) |
| 9 | +- [List](#employees_list) |
| 10 | +- [ListByResourceGroup](#employees_listbyresourcegroup) |
| 11 | +- [Update](#employees_update) |
| 12 | + |
| 13 | +## Operations |
| 14 | + |
| 15 | +- [List](#operations_list) |
| 16 | +### Employees_CreateOrUpdate |
| 17 | + |
| 18 | +```java |
| 19 | +/** |
| 20 | + * Samples for Operations List. |
| 21 | + */ |
| 22 | +public final class OperationsListSamples { |
| 23 | + /* |
| 24 | + * x-ms-original-file: 2021-11-01/Operations_List.json |
| 25 | + */ |
| 26 | + /** |
| 27 | + * Sample code: Operations_List. |
| 28 | + * |
| 29 | + * @param manager Entry point to ContosoManager. |
| 30 | + */ |
| 31 | + public static void operationsList(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 32 | + manager.operations().list(com.azure.core.util.Context.NONE); |
| 33 | + } |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +### Employees_Delete |
| 38 | + |
| 39 | +```java |
| 40 | +/** |
| 41 | + * Samples for Employees List. |
| 42 | + */ |
| 43 | +public final class EmployeesListSamples { |
| 44 | + /* |
| 45 | + * x-ms-original-file: 2021-11-01/Employees_ListBySubscription.json |
| 46 | + */ |
| 47 | + /** |
| 48 | + * Sample code: Employees_ListBySubscription. |
| 49 | + * |
| 50 | + * @param manager Entry point to ContosoManager. |
| 51 | + */ |
| 52 | + public static void employeesListBySubscription(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 53 | + manager.employees().list(com.azure.core.util.Context.NONE); |
| 54 | + } |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +### Employees_GetByResourceGroup |
| 59 | + |
| 60 | +```java |
| 61 | +/** |
| 62 | + * Samples for Employees GetByResourceGroup. |
| 63 | + */ |
| 64 | +public final class EmployeesGetByResourceGroupSamples { |
| 65 | + /* |
| 66 | + * x-ms-original-file: 2021-11-01/Employees_Get.json |
| 67 | + */ |
| 68 | + /** |
| 69 | + * Sample code: Employees_Get. |
| 70 | + * |
| 71 | + * @param manager Entry point to ContosoManager. |
| 72 | + */ |
| 73 | + public static void employeesGet(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 74 | + manager.employees() |
| 75 | + .getByResourceGroupWithResponse("rgopenapi", "le-8MU--J3W6q8D386p3-iT3", com.azure.core.util.Context.NONE); |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +### Employees_List |
| 81 | + |
| 82 | +```java |
| 83 | +/** |
| 84 | + * Samples for Employees ListByResourceGroup. |
| 85 | + */ |
| 86 | +public final class EmployeesListByResourceGroupSamples { |
| 87 | + /* |
| 88 | + * x-ms-original-file: 2021-11-01/Employees_ListByResourceGroup.json |
| 89 | + */ |
| 90 | + /** |
| 91 | + * Sample code: Employees_ListByResourceGroup. |
| 92 | + * |
| 93 | + * @param manager Entry point to ContosoManager. |
| 94 | + */ |
| 95 | + public static void employeesListByResourceGroup(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 96 | + manager.employees().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +### Employees_ListByResourceGroup |
| 102 | + |
| 103 | +```java |
| 104 | +import com.azure.resourcemanager.contoso.models.Employee; |
| 105 | +import com.azure.resourcemanager.contoso.models.EmployeeProperties; |
| 106 | +import java.util.HashMap; |
| 107 | +import java.util.Map; |
| 108 | + |
| 109 | +/** |
| 110 | + * Samples for Employees Update. |
| 111 | + */ |
| 112 | +public final class EmployeesUpdateSamples { |
| 113 | + /* |
| 114 | + * x-ms-original-file: 2021-11-01/Employees_Update.json |
| 115 | + */ |
| 116 | + /** |
| 117 | + * Sample code: Employees_Update. |
| 118 | + * |
| 119 | + * @param manager Entry point to ContosoManager. |
| 120 | + */ |
| 121 | + public static void employeesUpdate(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 122 | + Employee resource = manager.employees() |
| 123 | + .getByResourceGroupWithResponse("rgopenapi", "-XhyNJ--", com.azure.core.util.Context.NONE) |
| 124 | + .getValue(); |
| 125 | + resource.update() |
| 126 | + .withTags(mapOf("key7952", "fakeTokenPlaceholder")) |
| 127 | + .withProperties( |
| 128 | + new EmployeeProperties().withAge(24).withCity("uyfg").withProfile("oapgijcswfkruiuuzbwco".getBytes())) |
| 129 | + .apply(); |
| 130 | + } |
| 131 | + |
| 132 | + // Use "Map.of" if available |
| 133 | + @SuppressWarnings("unchecked") |
| 134 | + private static <T> Map<String, T> mapOf(Object... inputs) { |
| 135 | + Map<String, T> map = new HashMap<>(); |
| 136 | + for (int i = 0; i < inputs.length; i += 2) { |
| 137 | + String key = (String) inputs[i]; |
| 138 | + T value = (T) inputs[i + 1]; |
| 139 | + map.put(key, value); |
| 140 | + } |
| 141 | + return map; |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +### Employees_Update |
| 147 | + |
| 148 | +```java |
| 149 | +import com.azure.resourcemanager.contoso.models.EmployeeProperties; |
| 150 | +import java.util.HashMap; |
| 151 | +import java.util.Map; |
| 152 | + |
| 153 | +/** |
| 154 | + * Samples for Employees CreateOrUpdate. |
| 155 | + */ |
| 156 | +public final class EmployeesCreateOrUpdateSamples { |
| 157 | + /* |
| 158 | + * x-ms-original-file: 2021-11-01/Employees_CreateOrUpdate.json |
| 159 | + */ |
| 160 | + /** |
| 161 | + * Sample code: Employees_CreateOrUpdate. |
| 162 | + * |
| 163 | + * @param manager Entry point to ContosoManager. |
| 164 | + */ |
| 165 | + public static void employeesCreateOrUpdate(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 166 | + manager.employees() |
| 167 | + .define("9KF-f-8b") |
| 168 | + .withRegion("itajgxyqozseoygnl") |
| 169 | + .withExistingResourceGroup("rgopenapi") |
| 170 | + .withTags(mapOf("key2913", "fakeTokenPlaceholder")) |
| 171 | + .withProperties(new EmployeeProperties().withAge(30) |
| 172 | + .withCity("gydhnntudughbmxlkyzrskcdkotrxn") |
| 173 | + .withProfile("ms".getBytes())) |
| 174 | + .create(); |
| 175 | + } |
| 176 | + |
| 177 | + // Use "Map.of" if available |
| 178 | + @SuppressWarnings("unchecked") |
| 179 | + private static <T> Map<String, T> mapOf(Object... inputs) { |
| 180 | + Map<String, T> map = new HashMap<>(); |
| 181 | + for (int i = 0; i < inputs.length; i += 2) { |
| 182 | + String key = (String) inputs[i]; |
| 183 | + T value = (T) inputs[i + 1]; |
| 184 | + map.put(key, value); |
| 185 | + } |
| 186 | + return map; |
| 187 | + } |
| 188 | +} |
| 189 | +``` |
| 190 | + |
| 191 | +### Operations_List |
| 192 | + |
| 193 | +```java |
| 194 | +/** |
| 195 | + * Samples for Employees Delete. |
| 196 | + */ |
| 197 | +public final class EmployeesDeleteSamples { |
| 198 | + /* |
| 199 | + * x-ms-original-file: 2021-11-01/Employees_Delete.json |
| 200 | + */ |
| 201 | + /** |
| 202 | + * Sample code: Employees_Delete. |
| 203 | + * |
| 204 | + * @param manager Entry point to ContosoManager. |
| 205 | + */ |
| 206 | + public static void employeesDelete(com.azure.resourcemanager.contoso.ContosoManager manager) { |
| 207 | + manager.employees().delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569", com.azure.core.util.Context.NONE); |
| 208 | + } |
| 209 | +} |
| 210 | +``` |
| 211 | + |
0 commit comments