-
Notifications
You must be signed in to change notification settings - Fork 11
/
AutomationRules_Get.go
127 lines (124 loc) · 7.61 KB
/
AutomationRules_Get.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package armsecurityinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2022-09-01-preview/examples/automationRules/AutomationRules_Get.json
func ExampleAutomationRulesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsecurityinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAutomationRulesClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AutomationRule = armsecurityinsights.AutomationRule{
// Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"),
// Type: to.Ptr("Microsoft.SecurityInsights/automationRules"),
// ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/automationRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"),
// Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""),
// Properties: &armsecurityinsights.AutomationRuleProperties{
// Actions: []armsecurityinsights.AutomationRuleActionClassification{
// &armsecurityinsights.AutomationRuleRunPlaybookAction{
// ActionType: to.Ptr(armsecurityinsights.ActionTypeRunPlaybook),
// Order: to.Ptr[int32](1),
// ActionConfiguration: &armsecurityinsights.PlaybookActionProperties{
// LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/IncidentPlaybook"),
// TenantID: to.Ptr("d23e3eef-eed0-428f-a2d5-bc48c268e31d"),
// },
// }},
// CreatedBy: &armsecurityinsights.ClientInfo{
// Name: to.Ptr("john doe"),
// Email: to.Ptr("john.doe@contoso.com"),
// ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"),
// UserPrincipalName: to.Ptr("john@contoso.com"),
// },
// CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:00Z"); return t}()),
// DisplayName: to.Ptr("Suspicious alerts in workspace"),
// LastModifiedBy: &armsecurityinsights.ClientInfo{
// Name: to.Ptr("john doe"),
// Email: to.Ptr("john.doe@contoso.com"),
// ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"),
// UserPrincipalName: to.Ptr("john@contoso.com"),
// },
// LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30Z"); return t}()),
// Order: to.Ptr[int32](1),
// TriggeringLogic: &armsecurityinsights.AutomationRuleTriggeringLogic{
// Conditions: []armsecurityinsights.AutomationRuleConditionClassification{
// &armsecurityinsights.BooleanConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypeBoolean),
// ConditionProperties: &armsecurityinsights.AutomationRuleBooleanCondition{
// InnerConditions: []armsecurityinsights.AutomationRuleConditionClassification{
// &armsecurityinsights.PropertyConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{
// Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorEquals),
// PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyAccountName),
// PropertyValues: []*string{
// to.Ptr("Administrator")},
// },
// },
// &armsecurityinsights.PropertyConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{
// Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorEquals),
// PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyHostName),
// PropertyValues: []*string{
// to.Ptr("MainServer")},
// },
// }},
// Operator: to.Ptr(armsecurityinsights.AutomationRuleBooleanConditionSupportedOperatorOr),
// },
// },
// &armsecurityinsights.PropertyArrayConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypePropertyArray),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyArrayValuesCondition{
// ArrayConditionType: to.Ptr(armsecurityinsights.AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem),
// ArrayType: to.Ptr(armsecurityinsights.AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails),
// ItemConditions: []armsecurityinsights.AutomationRuleConditionClassification{
// &armsecurityinsights.PropertyConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{
// Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorEquals),
// PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey),
// PropertyValues: []*string{
// to.Ptr("AlertTags")},
// },
// },
// &armsecurityinsights.PropertyArrayConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypePropertyArray),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyArrayValuesCondition{
// ArrayConditionType: to.Ptr(armsecurityinsights.AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem),
// ArrayType: to.Ptr(armsecurityinsights.AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues),
// ItemConditions: []armsecurityinsights.AutomationRuleConditionClassification{
// &armsecurityinsights.PropertyConditionProperties{
// ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty),
// ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{
// Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorEquals),
// PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue),
// PropertyValues: []*string{
// to.Ptr("HighPriority")},
// },
// }},
// },
// }},
// },
// }},
// IsEnabled: to.Ptr(true),
// TriggersOn: to.Ptr(armsecurityinsights.TriggersOnIncidents),
// TriggersWhen: to.Ptr(armsecurityinsights.TriggersWhenCreated),
// },
// },
// }
}