-
Notifications
You must be signed in to change notification settings - Fork 11
/
ListSecureScoreControlDefinitions_subscription_example.go
103 lines (100 loc) · 4.9 KB
/
ListSecureScoreControlDefinitions_subscription_example.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
package armsecurity_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e716082ac474f182e2220e4f38f1d6191e7636cf/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json
func ExampleSecureScoreControlDefinitionsClient_NewListBySubscriptionPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsecurity.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewSecureScoreControlDefinitionsClient().NewListBySubscriptionPager(nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.SecureScoreControlDefinitionList = armsecurity.SecureScoreControlDefinitionList{
// Value: []*armsecurity.SecureScoreControlDefinitionItem{
// {
// Name: to.Ptr("a9909064-42b4-4d34-8143-275477afe18b"),
// Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"),
// ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a9909064-42b4-4d34-8143-275477afe18b"),
// Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{
// Description: to.Ptr("This control contains recommendations regarding DDoS attack prevention"),
// AssessmentDefinitions: []*armsecurity.AzureResourceLink{
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e3de1cc0-f4dd-3b34-e496-8b5381ba2d70"),
// }},
// DisplayName: to.Ptr("Protect applications against DDoS attacks"),
// MaxScore: to.Ptr[int32](2),
// Source: &armsecurity.SecureScoreControlDefinitionSource{
// SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn),
// },
// },
// },
// {
// Name: to.Ptr("34a42fb3-e6db-409c-b56b-7b1db6b8aee0"),
// Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"),
// ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/34a42fb3-e6db-409c-b56b-7b1db6b8aee0"),
// Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{
// Description: to.Ptr("This control contains recommendations regarding MFA"),
// AssessmentDefinitions: []*armsecurity.AzureResourceLink{
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/151e82c5-5341-a74b-1eb0-bc38d2c84bb5"),
// },
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/57e98606-6b1e-6193-0e3d-fe621387c16b"),
// },
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/94290b00-4d0c-d7b4-7cea-064a9554e681"),
// }},
// DisplayName: to.Ptr("Enable MFA"),
// MaxScore: to.Ptr[int32](10),
// Source: &armsecurity.SecureScoreControlDefinitionSource{
// SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn),
// },
// },
// },
// {
// Name: to.Ptr("a000c66f-6da2-4f9d-826d-2364347d2588"),
// Type: to.Ptr("Microsoft.Security/SecureScoreControlDefinitions"),
// ID: to.Ptr("/providers/Microsoft.Security/SecureScoreControlDefinitions/a000c66f-6da2-4f9d-826d-2364347d2588"),
// Properties: &armsecurity.SecureScoreControlDefinitionItemProperties{
// Description: to.Ptr("This control contains recommendations regarding enabling adaptive application control"),
// AssessmentDefinitions: []*armsecurity.AzureResourceLink{
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/35f45c95-27cf-4e52-891f-8390d1de5828"),
// },
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/d1db3318-01ff-16de-29eb-28b344515626"),
// },
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/e7ee30c4-bac9-2966-54bd-2023a4282872"),
// },
// {
// ID: to.Ptr("/providers/Microsoft.Security/assessmentMetadata/8e2b96ff-3de2-289b-b5c1-3b9921a3441e"),
// }},
// DisplayName: to.Ptr("Apply adaptive application control"),
// MaxScore: to.Ptr[int32](3),
// Source: &armsecurity.SecureScoreControlDefinitionSource{
// SourceType: to.Ptr(armsecurity.ControlTypeBuiltIn),
// },
// },
// }},
// }
}
}