|
| 1 | +# Code snippets and samples |
| 2 | + |
| 3 | + |
| 4 | +## Operations |
| 5 | + |
| 6 | +- [List](#operations_list) |
| 7 | + |
| 8 | +## ProfessionalServiceOperation |
| 9 | + |
| 10 | +- [Get](#professionalserviceoperation_get) |
| 11 | + |
| 12 | +## ProfessionalServiceSubscriptionLevel |
| 13 | + |
| 14 | +- [CreateOrUpdate](#professionalservicesubscriptionlevel_createorupdate) |
| 15 | +- [Delete](#professionalservicesubscriptionlevel_delete) |
| 16 | +- [GetByResourceGroup](#professionalservicesubscriptionlevel_getbyresourcegroup) |
| 17 | +- [List](#professionalservicesubscriptionlevel_list) |
| 18 | +- [ListByResourceGroup](#professionalservicesubscriptionlevel_listbyresourcegroup) |
| 19 | +- [UpdateToUnsubscribed](#professionalservicesubscriptionlevel_updatetounsubscribed) |
| 20 | +### Operations_List |
| 21 | + |
| 22 | +```java |
| 23 | +/** Samples for Operations List. */ |
| 24 | +public final class OperationsListSamples { |
| 25 | + /* |
| 26 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/Operation/GetRpOperations.json |
| 27 | + */ |
| 28 | + /** |
| 29 | + * Sample code: Get ProfessionalService operations. |
| 30 | + * |
| 31 | + * @param manager Entry point to ProfessionalServiceManager. |
| 32 | + */ |
| 33 | + public static void getProfessionalServiceOperations( |
| 34 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 35 | + manager.operations().list(com.azure.core.util.Context.NONE); |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +### ProfessionalServiceOperation_Get |
| 41 | + |
| 42 | +```java |
| 43 | +/** Samples for ProfessionalServiceOperation Get. */ |
| 44 | +public final class ProfessionalServiceOperationGetSamples { |
| 45 | + /* |
| 46 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/Operation/GetOperation.json |
| 47 | + */ |
| 48 | + /** |
| 49 | + * Sample code: Get operation status. |
| 50 | + * |
| 51 | + * @param manager Entry point to ProfessionalServiceManager. |
| 52 | + */ |
| 53 | + public static void getOperationStatus( |
| 54 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 55 | + manager |
| 56 | + .professionalServiceOperations() |
| 57 | + .get("2499e7c2-d251-4a54-9b0f-7673fe325283", com.azure.core.util.Context.NONE); |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +### ProfessionalServiceSubscriptionLevel_CreateOrUpdate |
| 63 | + |
| 64 | +```java |
| 65 | +import com.azure.resourcemanager.professionalservice.models.ProfessionalServiceCreationProperties; |
| 66 | + |
| 67 | +/** Samples for ProfessionalServiceSubscriptionLevel CreateOrUpdate. */ |
| 68 | +public final class ProfessionalServiceSubscriptionLevelCreateOrUpdateSamples { |
| 69 | + /* |
| 70 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServicePutIndefiniteTerm.json |
| 71 | + */ |
| 72 | + /** |
| 73 | + * Sample code: Create subscription level ProfessionalService resource (indefinite term). |
| 74 | + * |
| 75 | + * @param manager Entry point to ProfessionalServiceManager. |
| 76 | + */ |
| 77 | + public static void createSubscriptionLevelProfessionalServiceResourceIndefiniteTerm( |
| 78 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 79 | + manager |
| 80 | + .professionalServiceSubscriptionLevels() |
| 81 | + .define("MyContosoPS") |
| 82 | + .withExistingResourceGroup("c825645b-e31b-9cf4-1cee-2aba9e58bc7c", "my-ps-rg") |
| 83 | + .withRegion("global") |
| 84 | + .withName("MyContosoPS") |
| 85 | + .withProperties( |
| 86 | + new ProfessionalServiceCreationProperties() |
| 87 | + .withOfferId("testprofservice") |
| 88 | + .withPublisherId("microsoft-contoso") |
| 89 | + .withSkuId("ff051f4f-a6d9-4cbc-8d9a-2a41bd468abc") |
| 90 | + .withQuoteId("quoteabc")) |
| 91 | + .create(); |
| 92 | + } |
| 93 | + |
| 94 | + /* |
| 95 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServicePutWithTerm.json |
| 96 | + */ |
| 97 | + /** |
| 98 | + * Sample code: Create subscription level ProfessionalService resource (with term). |
| 99 | + * |
| 100 | + * @param manager Entry point to ProfessionalServiceManager. |
| 101 | + */ |
| 102 | + public static void createSubscriptionLevelProfessionalServiceResourceWithTerm( |
| 103 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 104 | + manager |
| 105 | + .professionalServiceSubscriptionLevels() |
| 106 | + .define("MyContosoPS") |
| 107 | + .withExistingResourceGroup("c825645b-e31b-9cf4-1cee-2aba9e58bc7c", "my-ps-rg") |
| 108 | + .withRegion("global") |
| 109 | + .withName("MyContosoPS") |
| 110 | + .withProperties( |
| 111 | + new ProfessionalServiceCreationProperties() |
| 112 | + .withOfferId("testprofservice") |
| 113 | + .withPublisherId("microsoft-contoso") |
| 114 | + .withSkuId("ff051f4f-a6d9-4cbc-8d9a-2a41bd468abc") |
| 115 | + .withQuoteId("quoteabc") |
| 116 | + .withTermUnit("P3Y") |
| 117 | + .withBillingPeriod("P1Y")) |
| 118 | + .create(); |
| 119 | + } |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +### ProfessionalServiceSubscriptionLevel_Delete |
| 124 | + |
| 125 | +```java |
| 126 | +/** Samples for ProfessionalServiceSubscriptionLevel Delete. */ |
| 127 | +public final class ProfessionalServiceSubscriptionLevelDeleteSamples { |
| 128 | + /* |
| 129 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServiceDelete.json |
| 130 | + */ |
| 131 | + /** |
| 132 | + * Sample code: Delete Subscription Level ProfessionalService resource. |
| 133 | + * |
| 134 | + * @param manager Entry point to ProfessionalServiceManager. |
| 135 | + */ |
| 136 | + public static void deleteSubscriptionLevelProfessionalServiceResource( |
| 137 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 138 | + manager |
| 139 | + .professionalServiceSubscriptionLevels() |
| 140 | + .delete( |
| 141 | + "c825645b-e31b-9cf4-1cee-2aba9e58bc7c", "my-ps-rg", "MyContosoPS", com.azure.core.util.Context.NONE); |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +### ProfessionalServiceSubscriptionLevel_GetByResourceGroup |
| 147 | + |
| 148 | +```java |
| 149 | +/** Samples for ProfessionalServiceSubscriptionLevel GetByResourceGroup. */ |
| 150 | +public final class ProfessionalServiceSubscriptionLevelGetByResourceGroupSamples { |
| 151 | + /* |
| 152 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServiceGet.json |
| 153 | + */ |
| 154 | + /** |
| 155 | + * Sample code: Get subscription level ProfessionalService resource. |
| 156 | + * |
| 157 | + * @param manager Entry point to ProfessionalServiceManager. |
| 158 | + */ |
| 159 | + public static void getSubscriptionLevelProfessionalServiceResource( |
| 160 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 161 | + manager |
| 162 | + .professionalServiceSubscriptionLevels() |
| 163 | + .getByResourceGroupWithResponse( |
| 164 | + "c825645b-e31b-9cf4-1cee-2aba9e58bc7c", |
| 165 | + "my-ps-rg", |
| 166 | + "ps_subscription", |
| 167 | + com.azure.core.util.Context.NONE); |
| 168 | + } |
| 169 | +} |
| 170 | +``` |
| 171 | + |
| 172 | +### ProfessionalServiceSubscriptionLevel_List |
| 173 | + |
| 174 | +```java |
| 175 | +/** Samples for ProfessionalServiceSubscriptionLevel List. */ |
| 176 | +public final class ProfessionalServiceSubscriptionLevelListSamples { |
| 177 | + /* |
| 178 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServiceGetAllInAzureSubscription.json |
| 179 | + */ |
| 180 | + /** |
| 181 | + * Sample code: Get subscription level ProfessionalService resources in Azure subscription. |
| 182 | + * |
| 183 | + * @param manager Entry point to ProfessionalServiceManager. |
| 184 | + */ |
| 185 | + public static void getSubscriptionLevelProfessionalServiceResourcesInAzureSubscription( |
| 186 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 187 | + manager |
| 188 | + .professionalServiceSubscriptionLevels() |
| 189 | + .list("c825645b-e31b-9cf4-1cee-2aba9e58bc7c", com.azure.core.util.Context.NONE); |
| 190 | + } |
| 191 | +} |
| 192 | +``` |
| 193 | + |
| 194 | +### ProfessionalServiceSubscriptionLevel_ListByResourceGroup |
| 195 | + |
| 196 | +```java |
| 197 | +/** Samples for ProfessionalServiceSubscriptionLevel ListByResourceGroup. */ |
| 198 | +public final class ProfessionalServiceSubscriptionLevelListByResourceGroupSamples { |
| 199 | + /* |
| 200 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServiceGetAllInResourceGroup.json |
| 201 | + */ |
| 202 | + /** |
| 203 | + * Sample code: Get subscription level ProfessionalService resources in resource group. |
| 204 | + * |
| 205 | + * @param manager Entry point to ProfessionalServiceManager. |
| 206 | + */ |
| 207 | + public static void getSubscriptionLevelProfessionalServiceResourcesInResourceGroup( |
| 208 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 209 | + manager |
| 210 | + .professionalServiceSubscriptionLevels() |
| 211 | + .listByResourceGroup("c825645b-e31b-9cf4-1cee-2aba9e58bc7c", "my-ps-rg", com.azure.core.util.Context.NONE); |
| 212 | + } |
| 213 | +} |
| 214 | +``` |
| 215 | + |
| 216 | +### ProfessionalServiceSubscriptionLevel_UpdateToUnsubscribed |
| 217 | + |
| 218 | +```java |
| 219 | +import com.azure.resourcemanager.professionalservice.models.DeleteOptions; |
| 220 | + |
| 221 | +/** Samples for ProfessionalServiceSubscriptionLevel UpdateToUnsubscribed. */ |
| 222 | +public final class ProfessionalServiceSubscriptionLevelUpdateToUnsubscribedSamples { |
| 223 | + /* |
| 224 | + * x-ms-original-file: specification/professionalservice/resource-manager/Microsoft.ProfessionalService/preview/2023-07-01-preview/examples/ProfessionalService/ProfessionalServiceUnsubscribe.json |
| 225 | + */ |
| 226 | + /** |
| 227 | + * Sample code: Unsubscribe Subscription Level ProfessionalService resource. |
| 228 | + * |
| 229 | + * @param manager Entry point to ProfessionalServiceManager. |
| 230 | + */ |
| 231 | + public static void unsubscribeSubscriptionLevelProfessionalServiceResource( |
| 232 | + com.azure.resourcemanager.professionalservice.ProfessionalServiceManager manager) { |
| 233 | + manager |
| 234 | + .professionalServiceSubscriptionLevels() |
| 235 | + .updateToUnsubscribed( |
| 236 | + "c825645b-e31b-9cf4-1cee-2aba9e58bc7c", |
| 237 | + "my-ps-rg", |
| 238 | + "MyContosoPS", |
| 239 | + new DeleteOptions() |
| 240 | + .withUnsubscribeOnly(true) |
| 241 | + .withReasonCode(0.0F) |
| 242 | + .withFeedback("No longer need this ProfessionalService"), |
| 243 | + com.azure.core.util.Context.NONE); |
| 244 | + } |
| 245 | +} |
| 246 | +``` |
| 247 | + |
0 commit comments