|
| 1 | +# Code snippets and samples |
| 2 | + |
| 3 | + |
| 4 | +## AttestationProviders |
| 5 | + |
| 6 | +- [Create](#attestationproviders_create) |
| 7 | +- [Delete](#attestationproviders_delete) |
| 8 | +- [GetByResourceGroup](#attestationproviders_getbyresourcegroup) |
| 9 | +- [GetDefaultByLocation](#attestationproviders_getdefaultbylocation) |
| 10 | +- [List](#attestationproviders_list) |
| 11 | +- [ListByResourceGroup](#attestationproviders_listbyresourcegroup) |
| 12 | +- [ListDefault](#attestationproviders_listdefault) |
| 13 | +- [Update](#attestationproviders_update) |
| 14 | + |
| 15 | +## Operations |
| 16 | + |
| 17 | +- [List](#operations_list) |
| 18 | + |
| 19 | +## PrivateEndpointConnections |
| 20 | + |
| 21 | +- [Create](#privateendpointconnections_create) |
| 22 | +- [Delete](#privateendpointconnections_delete) |
| 23 | +- [Get](#privateendpointconnections_get) |
| 24 | +- [List](#privateendpointconnections_list) |
| 25 | +### AttestationProviders_Create |
| 26 | + |
| 27 | +```java |
| 28 | +import com.azure.resourcemanager.attestation.models.AttestationServiceCreationSpecificParams; |
| 29 | + |
| 30 | +/** Samples for AttestationProviders Create. */ |
| 31 | +public final class AttestationProvidersCreateSamples { |
| 32 | + /* |
| 33 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Create_AttestationProvider.json |
| 34 | + */ |
| 35 | + /** |
| 36 | + * Sample code: AttestationProviders_Create. |
| 37 | + * |
| 38 | + * @param manager Entry point to AttestationManager. |
| 39 | + */ |
| 40 | + public static void attestationProvidersCreate(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 41 | + manager |
| 42 | + .attestationProviders() |
| 43 | + .define("myattestationprovider") |
| 44 | + .withRegion((String) null) |
| 45 | + .withExistingResourceGroup("MyResourceGroup") |
| 46 | + .withProperties((AttestationServiceCreationSpecificParams) null) |
| 47 | + .create(); |
| 48 | + } |
| 49 | +} |
| 50 | +``` |
| 51 | + |
| 52 | +### AttestationProviders_Delete |
| 53 | + |
| 54 | +```java |
| 55 | +import com.azure.core.util.Context; |
| 56 | + |
| 57 | +/** Samples for AttestationProviders Delete. */ |
| 58 | +public final class AttestationProvidersDeleteSamples { |
| 59 | + /* |
| 60 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Delete_AttestationProvider.json |
| 61 | + */ |
| 62 | + /** |
| 63 | + * Sample code: AttestationProviders_Delete. |
| 64 | + * |
| 65 | + * @param manager Entry point to AttestationManager. |
| 66 | + */ |
| 67 | + public static void attestationProvidersDelete(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 68 | + manager |
| 69 | + .attestationProviders() |
| 70 | + .deleteWithResponse("sample-resource-group", "myattestationprovider", Context.NONE); |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +### AttestationProviders_GetByResourceGroup |
| 76 | + |
| 77 | +```java |
| 78 | +import com.azure.core.util.Context; |
| 79 | + |
| 80 | +/** Samples for AttestationProviders GetByResourceGroup. */ |
| 81 | +public final class AttestationProvidersGetByResourceGroupSamples { |
| 82 | + /* |
| 83 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Get_AttestationProvider.json |
| 84 | + */ |
| 85 | + /** |
| 86 | + * Sample code: AttestationProviders_Get. |
| 87 | + * |
| 88 | + * @param manager Entry point to AttestationManager. |
| 89 | + */ |
| 90 | + public static void attestationProvidersGet(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 91 | + manager |
| 92 | + .attestationProviders() |
| 93 | + .getByResourceGroupWithResponse("MyResourceGroup", "myattestationprovider", Context.NONE); |
| 94 | + } |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +### AttestationProviders_GetDefaultByLocation |
| 99 | + |
| 100 | +```java |
| 101 | +import com.azure.core.util.Context; |
| 102 | + |
| 103 | +/** Samples for AttestationProviders GetDefaultByLocation. */ |
| 104 | +public final class AttestationProvidersGetDefaultByLocationSamples { |
| 105 | + /* |
| 106 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Get_DefaultProviderByLocation.json |
| 107 | + */ |
| 108 | + /** |
| 109 | + * Sample code: AttestationProviders_GetDefaultWithLocation. |
| 110 | + * |
| 111 | + * @param manager Entry point to AttestationManager. |
| 112 | + */ |
| 113 | + public static void attestationProvidersGetDefaultWithLocation( |
| 114 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 115 | + manager.attestationProviders().getDefaultByLocationWithResponse("Central US", Context.NONE); |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +### AttestationProviders_List |
| 121 | + |
| 122 | +```java |
| 123 | +import com.azure.core.util.Context; |
| 124 | + |
| 125 | +/** Samples for AttestationProviders List. */ |
| 126 | +public final class AttestationProvidersListSamples { |
| 127 | + /* |
| 128 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Get_AttestationProvidersList.json |
| 129 | + */ |
| 130 | + /** |
| 131 | + * Sample code: AttestationProviders_List. |
| 132 | + * |
| 133 | + * @param manager Entry point to AttestationManager. |
| 134 | + */ |
| 135 | + public static void attestationProvidersList(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 136 | + manager.attestationProviders().listWithResponse(Context.NONE); |
| 137 | + } |
| 138 | +} |
| 139 | +``` |
| 140 | + |
| 141 | +### AttestationProviders_ListByResourceGroup |
| 142 | + |
| 143 | +```java |
| 144 | +import com.azure.core.util.Context; |
| 145 | + |
| 146 | +/** Samples for AttestationProviders ListByResourceGroup. */ |
| 147 | +public final class AttestationProvidersListByResourceGroupSamples { |
| 148 | + /* |
| 149 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Get_AttestationProvidersListByResourceGroup.json |
| 150 | + */ |
| 151 | + /** |
| 152 | + * Sample code: AttestationProviders_ListByResourceGroup. |
| 153 | + * |
| 154 | + * @param manager Entry point to AttestationManager. |
| 155 | + */ |
| 156 | + public static void attestationProvidersListByResourceGroup( |
| 157 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 158 | + manager.attestationProviders().listByResourceGroupWithResponse("testrg1", Context.NONE); |
| 159 | + } |
| 160 | +} |
| 161 | +``` |
| 162 | + |
| 163 | +### AttestationProviders_ListDefault |
| 164 | + |
| 165 | +```java |
| 166 | +import com.azure.core.util.Context; |
| 167 | + |
| 168 | +/** Samples for AttestationProviders ListDefault. */ |
| 169 | +public final class AttestationProvidersListDefaultSamples { |
| 170 | + /* |
| 171 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Get_DefaultProviders.json |
| 172 | + */ |
| 173 | + /** |
| 174 | + * Sample code: AttestationProviders_GetDefault. |
| 175 | + * |
| 176 | + * @param manager Entry point to AttestationManager. |
| 177 | + */ |
| 178 | + public static void attestationProvidersGetDefault( |
| 179 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 180 | + manager.attestationProviders().listDefaultWithResponse(Context.NONE); |
| 181 | + } |
| 182 | +} |
| 183 | +``` |
| 184 | + |
| 185 | +### AttestationProviders_Update |
| 186 | + |
| 187 | +```java |
| 188 | +import com.azure.core.util.Context; |
| 189 | +import com.azure.resourcemanager.attestation.models.AttestationProvider; |
| 190 | +import java.util.HashMap; |
| 191 | +import java.util.Map; |
| 192 | + |
| 193 | +/** Samples for AttestationProviders Update. */ |
| 194 | +public final class AttestationProvidersUpdateSamples { |
| 195 | + /* |
| 196 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Update_AttestationProvider.json |
| 197 | + */ |
| 198 | + /** |
| 199 | + * Sample code: AttestationProviders_Update. |
| 200 | + * |
| 201 | + * @param manager Entry point to AttestationManager. |
| 202 | + */ |
| 203 | + public static void attestationProvidersUpdate(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 204 | + AttestationProvider resource = |
| 205 | + manager |
| 206 | + .attestationProviders() |
| 207 | + .getByResourceGroupWithResponse("MyResourceGroup", "myattestationprovider", Context.NONE) |
| 208 | + .getValue(); |
| 209 | + resource.update().withTags(mapOf("Property1", "Value1", "Property2", "Value2", "Property3", "Value3")).apply(); |
| 210 | + } |
| 211 | + |
| 212 | + @SuppressWarnings("unchecked") |
| 213 | + private static <T> Map<String, T> mapOf(Object... inputs) { |
| 214 | + Map<String, T> map = new HashMap<>(); |
| 215 | + for (int i = 0; i < inputs.length; i += 2) { |
| 216 | + String key = (String) inputs[i]; |
| 217 | + T value = (T) inputs[i + 1]; |
| 218 | + map.put(key, value); |
| 219 | + } |
| 220 | + return map; |
| 221 | + } |
| 222 | +} |
| 223 | +``` |
| 224 | + |
| 225 | +### Operations_List |
| 226 | + |
| 227 | +```java |
| 228 | +import com.azure.core.util.Context; |
| 229 | + |
| 230 | +/** Samples for Operations List. */ |
| 231 | +public final class OperationsListSamples { |
| 232 | + /* |
| 233 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/Operations_List.json |
| 234 | + */ |
| 235 | + /** |
| 236 | + * Sample code: Operations_List. |
| 237 | + * |
| 238 | + * @param manager Entry point to AttestationManager. |
| 239 | + */ |
| 240 | + public static void operationsList(com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 241 | + manager.operations().listWithResponse(Context.NONE); |
| 242 | + } |
| 243 | +} |
| 244 | +``` |
| 245 | + |
| 246 | +### PrivateEndpointConnections_Create |
| 247 | + |
| 248 | +```java |
| 249 | +import com.azure.resourcemanager.attestation.models.PrivateEndpointServiceConnectionStatus; |
| 250 | +import com.azure.resourcemanager.attestation.models.PrivateLinkServiceConnectionState; |
| 251 | + |
| 252 | +/** Samples for PrivateEndpointConnections Create. */ |
| 253 | +public final class PrivateEndpointConnectionsCreateSamples { |
| 254 | + /* |
| 255 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/AttestationProviderPutPrivateEndpointConnection.json |
| 256 | + */ |
| 257 | + /** |
| 258 | + * Sample code: AttestationProviderPutPrivateEndpointConnection. |
| 259 | + * |
| 260 | + * @param manager Entry point to AttestationManager. |
| 261 | + */ |
| 262 | + public static void attestationProviderPutPrivateEndpointConnection( |
| 263 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 264 | + manager |
| 265 | + .privateEndpointConnections() |
| 266 | + .define("{privateEndpointConnectionName}") |
| 267 | + .withExistingAttestationProvider("res7687", "sto9699") |
| 268 | + .withPrivateLinkServiceConnectionState( |
| 269 | + new PrivateLinkServiceConnectionState() |
| 270 | + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) |
| 271 | + .withDescription("Auto-Approved")) |
| 272 | + .create(); |
| 273 | + } |
| 274 | +} |
| 275 | +``` |
| 276 | + |
| 277 | +### PrivateEndpointConnections_Delete |
| 278 | + |
| 279 | +```java |
| 280 | +import com.azure.core.util.Context; |
| 281 | + |
| 282 | +/** Samples for PrivateEndpointConnections Delete. */ |
| 283 | +public final class PrivateEndpointConnectionsDeleteSamples { |
| 284 | + /* |
| 285 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/AttestationProviderDeletePrivateEndpointConnection.json |
| 286 | + */ |
| 287 | + /** |
| 288 | + * Sample code: AttestationProviderDeletePrivateEndpointConnection. |
| 289 | + * |
| 290 | + * @param manager Entry point to AttestationManager. |
| 291 | + */ |
| 292 | + public static void attestationProviderDeletePrivateEndpointConnection( |
| 293 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 294 | + manager |
| 295 | + .privateEndpointConnections() |
| 296 | + .deleteWithResponse("res6977", "sto2527", "{privateEndpointConnectionName}", Context.NONE); |
| 297 | + } |
| 298 | +} |
| 299 | +``` |
| 300 | + |
| 301 | +### PrivateEndpointConnections_Get |
| 302 | + |
| 303 | +```java |
| 304 | +import com.azure.core.util.Context; |
| 305 | + |
| 306 | +/** Samples for PrivateEndpointConnections Get. */ |
| 307 | +public final class PrivateEndpointConnectionsGetSamples { |
| 308 | + /* |
| 309 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/AttestationProviderGetPrivateEndpointConnection.json |
| 310 | + */ |
| 311 | + /** |
| 312 | + * Sample code: AttestationProviderGetPrivateEndpointConnection. |
| 313 | + * |
| 314 | + * @param manager Entry point to AttestationManager. |
| 315 | + */ |
| 316 | + public static void attestationProviderGetPrivateEndpointConnection( |
| 317 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 318 | + manager |
| 319 | + .privateEndpointConnections() |
| 320 | + .getWithResponse("res6977", "sto2527", "{privateEndpointConnectionName}", Context.NONE); |
| 321 | + } |
| 322 | +} |
| 323 | +``` |
| 324 | + |
| 325 | +### PrivateEndpointConnections_List |
| 326 | + |
| 327 | +```java |
| 328 | +import com.azure.core.util.Context; |
| 329 | + |
| 330 | +/** Samples for PrivateEndpointConnections List. */ |
| 331 | +public final class PrivateEndpointConnectionsListSamples { |
| 332 | + /* |
| 333 | + * x-ms-original-file: specification/attestation/resource-manager/Microsoft.Attestation/stable/2020-10-01/examples/AttestationProviderListPrivateEndpointConnections.json |
| 334 | + */ |
| 335 | + /** |
| 336 | + * Sample code: AttestationProviderListPrivateEndpointConnections. |
| 337 | + * |
| 338 | + * @param manager Entry point to AttestationManager. |
| 339 | + */ |
| 340 | + public static void attestationProviderListPrivateEndpointConnections( |
| 341 | + com.azure.resourcemanager.attestation.AttestationManager manager) { |
| 342 | + manager.privateEndpointConnections().list("res6977", "sto2527", Context.NONE); |
| 343 | + } |
| 344 | +} |
| 345 | +``` |
| 346 | + |
0 commit comments