-
Notifications
You must be signed in to change notification settings - Fork 12
/
createOrUpdateConfigurationProfile.go
76 lines (73 loc) · 2.6 KB
/
createOrUpdateConfigurationProfile.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
73
74
75
76
package armautomanage_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/automanage/armautomanage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/automanage/resource-manager/Microsoft.Automanage/preview/2021-04-30-preview/examples/createOrUpdateConfigurationProfile.json
func ExampleConfigurationProfilesClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armautomanage.NewConfigurationProfilesClient("mySubscriptionId", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := client.CreateOrUpdate(ctx,
"customConfigurationProfile",
"myResourceGroupName",
armautomanage.ConfigurationProfile{
Location: to.Ptr("East US"),
Tags: map[string]*string{
"Organization": to.Ptr("Administration"),
},
Properties: &armautomanage.ConfigurationProfileProperties{
Configuration: map[string]interface{}{
"Antimalware/Enable": false,
"AzureSecurityCenter/Enable": true,
"Backup/Enable": false,
"BootDiagnostics/Enable": true,
"ChangeTrackingAndInventory/Enable": true,
"GuestConfiguration/Enable": true,
"LogAnalytics/Enable": true,
"UpdateManagement/Enable": true,
"VMInsights/Enable": true,
},
Overrides: []interface{}{
map[string]interface{}{
"if": map[string]interface{}{
"equals": "eastus",
"field": "$.location",
},
"priority": float64(100),
"then": map[string]interface{}{
"LogAnalytics/Enable": true,
"LogAnalytics/Reprovision": true,
"LogAnalytics/Workspace": "/subscriptions/abc/resourceGroups/xyz/providers/Microsoft.La/Workspaces/eastus",
},
},
map[string]interface{}{
"if": map[string]interface{}{
"equals": "centralcanada",
"field": "$.location",
},
"priority": float64(200),
"then": map[string]interface{}{
"LogAnalytics/Enable": true,
"LogAnalytics/Reprovision": true,
"LogAnalytics/Workspace": "/subscriptions/abc/resourceGroups/xyz/providers/Microsoft.La/Workspaces/centralcanada",
},
}},
},
},
nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// TODO: use response item
_ = res
}