-
Notifications
You must be signed in to change notification settings - Fork 11
/
ApplicationPutOperation_example_max.go
72 lines (69 loc) · 3.01 KB
/
ApplicationPutOperation_example_max.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package armservicefabric_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armservicefabric"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/servicefabric/resource-manager/Microsoft.ServiceFabric/stable/2021-06-01/examples/ApplicationPutOperation_example_max.json
func ExampleApplicationsClient_BeginCreateOrUpdate_putAnApplicationWithMaximumParameters() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armservicefabric.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewApplicationsClient().BeginCreateOrUpdate(ctx, "resRg", "myCluster", "myApp", armservicefabric.ApplicationResource{
Tags: map[string]*string{},
Properties: &armservicefabric.ApplicationResourceProperties{
MaximumNodes: to.Ptr[int64](3),
Metrics: []*armservicefabric.ApplicationMetricDescription{
{
Name: to.Ptr("metric1"),
MaximumCapacity: to.Ptr[int64](3),
ReservationCapacity: to.Ptr[int64](1),
TotalApplicationCapacity: to.Ptr[int64](5),
}},
MinimumNodes: to.Ptr[int64](1),
Parameters: map[string]*string{
"param1": to.Ptr("value1"),
},
RemoveApplicationCapacity: to.Ptr(false),
TypeVersion: to.Ptr("1.0"),
UpgradePolicy: &armservicefabric.ApplicationUpgradePolicy{
ApplicationHealthPolicy: &armservicefabric.ArmApplicationHealthPolicy{
ConsiderWarningAsError: to.Ptr(true),
DefaultServiceTypeHealthPolicy: &armservicefabric.ArmServiceTypeHealthPolicy{
MaxPercentUnhealthyPartitionsPerService: to.Ptr[int32](0),
MaxPercentUnhealthyReplicasPerPartition: to.Ptr[int32](0),
MaxPercentUnhealthyServices: to.Ptr[int32](0),
},
MaxPercentUnhealthyDeployedApplications: to.Ptr[int32](0),
},
ForceRestart: to.Ptr(false),
RollingUpgradeMonitoringPolicy: &armservicefabric.ArmRollingUpgradeMonitoringPolicy{
FailureAction: to.Ptr(armservicefabric.ArmUpgradeFailureActionRollback),
HealthCheckRetryTimeout: to.Ptr("00:10:00"),
HealthCheckStableDuration: to.Ptr("00:05:00"),
HealthCheckWaitDuration: to.Ptr("00:02:00"),
UpgradeDomainTimeout: to.Ptr("1.06:00:00"),
UpgradeTimeout: to.Ptr("01:00:00"),
},
UpgradeMode: to.Ptr(armservicefabric.RollingUpgradeModeMonitored),
UpgradeReplicaSetCheckTimeout: to.Ptr("01:00:00"),
},
TypeName: to.Ptr("myAppType"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}