You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importjava.util.HashMap;
importjava.util.Map;
/** * Samples for ApplicationTypeVersions CreateOrUpdate. */publicfinalclassApplicationTypeVersionsCreateOrUpdateSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeVersionPutOperation_example.json *//** * Sample code: Put an application type version. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAnApplicationTypeVersion(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypeVersions().define("1.0").withExistingApplicationType("resRg", "myCluster", "myAppType").withTags(mapOf()).withAppPackageUrl("http://fakelink.test.com/MyAppType").create();
}
// Use "Map.of" if available@SuppressWarnings("unchecked")
privatestatic <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = newHashMap<>();
for (inti = 0; i < inputs.length; i += 2) {
Stringkey = (String) inputs[i];
Tvalue = (T) inputs[i + 1];
map.put(key, value);
}
returnmap;
}
}
ApplicationTypeVersions_Delete
/** * Samples for ApplicationTypeVersions Delete. */publicfinalclassApplicationTypeVersionsDeleteSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeVersionDeleteOperation_example.json *//** * Sample code: Delete an application type version. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoiddeleteAnApplicationTypeVersion(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypeVersions().delete("resRg", "myCluster", "myAppType", "1.0", com.azure.core.util.Context.NONE);
}
}
ApplicationTypeVersions_Get
/** * Samples for ApplicationTypeVersions Get. */publicfinalclassApplicationTypeVersionsGetSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeVersionGetOperation_example.json *//** * Sample code: Get an application type version. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAnApplicationTypeVersion(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypeVersions().getWithResponse("resRg", "myCluster", "myAppType", "1.0", com.azure.core.util.Context.NONE);
}
}
ApplicationTypeVersions_List
/** * Samples for ApplicationTypeVersions List. */publicfinalclassApplicationTypeVersionsListSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeVersionListOperation_example.json *//** * Sample code: Get a list of application type version resources. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAListOfApplicationTypeVersionResources(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypeVersions().list("resRg", "myCluster", "myAppType", com.azure.core.util.Context.NONE);
}
}
ApplicationTypes_CreateOrUpdate
importjava.util.HashMap;
importjava.util.Map;
/** * Samples for ApplicationTypes CreateOrUpdate. */publicfinalclassApplicationTypesCreateOrUpdateSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeNamePutOperation_example.json *//** * Sample code: Put an application type. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAnApplicationType(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypes().define("myAppType").withExistingCluster("resRg", "myCluster").withTags(mapOf()).create();
}
// Use "Map.of" if available@SuppressWarnings("unchecked")
privatestatic <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = newHashMap<>();
for (inti = 0; i < inputs.length; i += 2) {
Stringkey = (String) inputs[i];
Tvalue = (T) inputs[i + 1];
map.put(key, value);
}
returnmap;
}
}
ApplicationTypes_Delete
/** * Samples for ApplicationTypes Delete. */publicfinalclassApplicationTypesDeleteSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeNameDeleteOperation_example.json *//** * Sample code: Delete an application type. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoiddeleteAnApplicationType(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypes().delete("resRg", "myCluster", "myAppType", com.azure.core.util.Context.NONE);
}
}
ApplicationTypes_Get
/** * Samples for ApplicationTypes Get. */publicfinalclassApplicationTypesGetSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeNameGetOperation_example.json *//** * Sample code: Get an application type. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAnApplicationType(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypes().getWithResponse("resRg", "myCluster", "myAppType", com.azure.core.util.Context.NONE);
}
}
ApplicationTypes_List
/** * Samples for ApplicationTypes List. */publicfinalclassApplicationTypesListSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationTypeNameListOperation_example.json *//** * Sample code: Get a list of application type name resources. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAListOfApplicationTypeNameResources(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applicationTypes().list("resRg", "myCluster", com.azure.core.util.Context.NONE);
}
}
Applications_CreateOrUpdate
importcom.azure.resourcemanager.servicefabric.models.ApplicationMetricDescription;
importcom.azure.resourcemanager.servicefabric.models.ApplicationUpgradePolicy;
importcom.azure.resourcemanager.servicefabric.models.ArmApplicationHealthPolicy;
importcom.azure.resourcemanager.servicefabric.models.ArmRollingUpgradeMonitoringPolicy;
importcom.azure.resourcemanager.servicefabric.models.ArmServiceTypeHealthPolicy;
importcom.azure.resourcemanager.servicefabric.models.ArmUpgradeFailureAction;
importcom.azure.resourcemanager.servicefabric.models.RollingUpgradeMode;
importjava.util.Arrays;
importjava.util.HashMap;
importjava.util.Map;
importjava.util.stream.Collectors;
/** * Samples for Applications CreateOrUpdate. */publicfinalclassApplicationsCreateOrUpdateSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationPutOperation_example_max.json *//** * Sample code: Put an application with maximum parameters. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAnApplicationWithMaximumParameters(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().define("myApp").withExistingCluster("resRg", "myCluster").withTags(mapOf()).withTypeName("myAppType").withTypeVersion("1.0").withParameters(mapOf("param1", "value1")).withUpgradePolicy(newApplicationUpgradePolicy().withUpgradeReplicaSetCheckTimeout("01:00:00").withForceRestart(false).withRollingUpgradeMonitoringPolicy(newArmRollingUpgradeMonitoringPolicy().withFailureAction(ArmUpgradeFailureAction.ROLLBACK).withHealthCheckWaitDuration("00:02:00").withHealthCheckStableDuration("00:05:00").withHealthCheckRetryTimeout("00:10:00").withUpgradeTimeout("01:00:00").withUpgradeDomainTimeout("1.06:00:00")).withApplicationHealthPolicy(newArmApplicationHealthPolicy().withConsiderWarningAsError(true).withMaxPercentUnhealthyDeployedApplications(0).withDefaultServiceTypeHealthPolicy(newArmServiceTypeHealthPolicy().withMaxPercentUnhealthyServices(0).withMaxPercentUnhealthyPartitionsPerService(0).withMaxPercentUnhealthyReplicasPerPartition(0))).withUpgradeMode(RollingUpgradeMode.MONITORED)).withMinimumNodes(1L).withMaximumNodes(3L).withRemoveApplicationCapacity(false).withMetrics(Arrays.asList(newApplicationMetricDescription().withName("metric1").withMaximumCapacity(3L).withReservationCapacity(1L).withTotalApplicationCapacity(5L))).create();
}
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationPutOperation_example_min.json *//** * Sample code: Put an application with minimum parameters. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAnApplicationWithMinimumParameters(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().define("myApp").withExistingCluster("resRg", "myCluster").withRegion("eastus").withTags(mapOf()).withTypeName("myAppType").withTypeVersion("1.0").withRemoveApplicationCapacity(false).create();
}
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationPutOperation_recreate_example.json *//** * Sample code: Put an application with recreate option. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAnApplicationWithRecreateOption(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().define("myApp").withExistingCluster("resRg", "myCluster").withTags(mapOf()).withTypeName("myAppType").withTypeVersion("1.0").withParameters(mapOf("param1", "value1")).withUpgradePolicy(newApplicationUpgradePolicy().withRecreateApplication(true)).create();
}
// Use "Map.of" if available@SuppressWarnings("unchecked")
privatestatic <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = newHashMap<>();
for (inti = 0; i < inputs.length; i += 2) {
Stringkey = (String) inputs[i];
Tvalue = (T) inputs[i + 1];
map.put(key, value);
}
returnmap;
}
}
Applications_Delete
/** * Samples for Applications Delete. */publicfinalclassApplicationsDeleteSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationDeleteOperation_example.json *//** * Sample code: Delete an application. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoiddeleteAnApplication(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().delete("resRg", "myCluster", "myApp", com.azure.core.util.Context.NONE);
}
}
Applications_Get
/** * Samples for Applications Get. */publicfinalclassApplicationsGetSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationGetOperation_example.json *//** * Sample code: Get an application. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAnApplication(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().getWithResponse("resRg", "myCluster", "myApp", com.azure.core.util.Context.NONE);
}
}
Applications_List
/** * Samples for Applications List. */publicfinalclassApplicationsListSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationListOperation_example.json *//** * Sample code: Get a list of application resources. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAListOfApplicationResources(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.applications().list("resRg", "myCluster", com.azure.core.util.Context.NONE);
}
}
/** * Samples for Operations List. */publicfinalclassOperationsListSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ListOperations.json *//** * Sample code: ListOperations. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidlistOperations(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.operations().list(com.azure.core.util.Context.NONE);
}
}
Services_CreateOrUpdate
importcom.azure.resourcemanager.servicefabric.models.ArmServicePackageActivationMode;
importcom.azure.resourcemanager.servicefabric.models.MoveCost;
importcom.azure.resourcemanager.servicefabric.models.ServiceCorrelationDescription;
importcom.azure.resourcemanager.servicefabric.models.ServiceCorrelationScheme;
importcom.azure.resourcemanager.servicefabric.models.ServiceLoadMetricDescription;
importcom.azure.resourcemanager.servicefabric.models.ServiceLoadMetricWeight;
importcom.azure.resourcemanager.servicefabric.models.SingletonPartitionSchemeDescription;
importcom.azure.resourcemanager.servicefabric.models.StatelessServiceProperties;
importjava.util.Arrays;
importjava.util.HashMap;
importjava.util.Map;
importjava.util.stream.Collectors;
/** * Samples for Services CreateOrUpdate. */publicfinalclassServicesCreateOrUpdateSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServicePutOperation_example_min.json *//** * Sample code: Put a service with minimum parameters. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAServiceWithMinimumParameters(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.services().define("myService").withExistingApplication("resRg", "myCluster", "myApp").withTags(mapOf()).withProperties(newStatelessServiceProperties().withServiceTypeName("myServiceType").withPartitionDescription(newSingletonPartitionSchemeDescription()).withInstanceCount(1)).create();
}
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServicePutOperation_example_max.json *//** * Sample code: Put a service with maximum parameters. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidputAServiceWithMaximumParameters(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.services().define("myService").withExistingApplication("resRg", "myCluster", "myApp").withTags(mapOf()).withProperties(newStatelessServiceProperties().withPlacementConstraints("NodeType==frontend").withCorrelationScheme(Arrays.asList(newServiceCorrelationDescription().withScheme(ServiceCorrelationScheme.AFFINITY).withServiceName("fabric:/app1/app1~svc1"))).withServiceLoadMetrics(Arrays.asList(newServiceLoadMetricDescription().withName("metric1").withWeight(ServiceLoadMetricWeight.LOW))).withServicePlacementPolicies(Arrays.asList()).withDefaultMoveCost(MoveCost.MEDIUM).withServiceTypeName("myServiceType").withPartitionDescription(newSingletonPartitionSchemeDescription()).withServicePackageActivationMode(ArmServicePackageActivationMode.SHARED_PROCESS).withServiceDnsName("my.service.dns").withInstanceCount(5)).create();
}
// Use "Map.of" if available@SuppressWarnings("unchecked")
privatestatic <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = newHashMap<>();
for (inti = 0; i < inputs.length; i += 2) {
Stringkey = (String) inputs[i];
Tvalue = (T) inputs[i + 1];
map.put(key, value);
}
returnmap;
}
}
Services_Delete
/** * Samples for Services Delete. */publicfinalclassServicesDeleteSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServiceDeleteOperation_example.json *//** * Sample code: Delete a service. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoiddeleteAService(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.services().delete("resRg", "myCluster", "myApp", "myService", com.azure.core.util.Context.NONE);
}
}
Services_Get
/** * Samples for Services Get. */publicfinalclassServicesGetSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServiceGetOperation_example.json *//** * Sample code: Get a service. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAService(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.services().getWithResponse("resRg", "myCluster", "myApp", "myService", com.azure.core.util.Context.NONE);
}
}
Services_List
/** * Samples for Services List. */publicfinalclassServicesListSamples {
/* * x-ms-original-file: specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ServiceListOperation_example.json *//** * Sample code: Get a list of service resources. * * @param manager Entry point to ServiceFabricManager. */publicstaticvoidgetAListOfServiceResources(com.azure.resourcemanager.servicefabric.ServiceFabricManagermanager) {
manager.services().list("resRg", "myCluster", "myApp", com.azure.core.util.Context.NONE);
}
}