-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathcves_client_example_test.go
More file actions
151 lines (147 loc) · 7.38 KB
/
Copy pathcves_client_example_test.go
File metadata and controls
151 lines (147 loc) · 7.38 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.
package armiotfirmwaredefense_test
import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotfirmwaredefense/armiotfirmwaredefense/v2"
"log"
)
// Generated from example definition: 2026-06-01-preview/Cves_ListByFirmware_MaximumSet_Gen.json
func ExampleCvesClient_NewListByFirmwarePager_cvesListByFirmwareMaximumSetGenGeneratedByMaximumSetRule() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotfirmwaredefense.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewCvesClient().NewListByFirmwarePager("rgiotfirmwaredefense", "exampleWorkspaceName", "00000000-0000-0000-0000-000000000000", 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 = armiotfirmwaredefense.CvesClientListByFirmwareResponse{
// CveResourceListResult: armiotfirmwaredefense.CveResourceListResult{
// Value: []*armiotfirmwaredefense.CveResource{
// {
// Properties: &armiotfirmwaredefense.CveResult{
// CveID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ComponentID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ComponentVersion: to.Ptr("1.0.0"),
// ComponentName: to.Ptr("apache"),
// Severity: to.Ptr("Medium"),
// Links: []*armiotfirmwaredefense.CveLink{
// {
// Href: to.Ptr("https://httpd.apache.org/security/vulnerabilities_24.html"),
// Label: to.Ptr("https://httpd.apache.org/security/vulnerabilities_24.html"),
// },
// },
// ProvisioningState: to.Ptr(armiotfirmwaredefense.ProvisioningStateSucceeded),
// CveName: to.Ptr("CVE-2000-00001"),
// EffectiveCvssScore: to.Ptr[float32](7.6),
// EffectiveCvssVersion: to.Ptr[int32](4),
// EffectiveVectorString: to.Ptr("CVSS:4.0/AV:A/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"),
// EffectiveExploitMaturity: to.Ptr(armiotfirmwaredefense.ExploitMaturityLevelProofOfConcept),
// CvssScores: []*armiotfirmwaredefense.CvssScore{
// {
// Version: to.Ptr[int32](3),
// Score: to.Ptr[float32](7.4),
// VectorString: to.Ptr("CVSS:3.0/AV:A/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"),
// },
// {
// Version: to.Ptr[int32](4),
// Score: to.Ptr[float32](7.6),
// VectorString: to.Ptr("CVSS:4.0/AV:A/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"),
// ExploitMaturity: to.Ptr(armiotfirmwaredefense.ExploitMaturityLevelProofOfConcept),
// },
// },
// Component: &armiotfirmwaredefense.CveComponent{
// ComponentID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Name: to.Ptr("apache"),
// Version: to.Ptr("1.0.0"),
// },
// CvssScore: to.Ptr("7.4"),
// CvssV2Score: to.Ptr("7.2"),
// CvssV3Score: to.Ptr("7.4"),
// CvssVersion: to.Ptr("3"),
// Description: to.Ptr("This is a sample description of the vulnerability."),
// FixedInVersions: []*string{
// to.Ptr("1.0.1"),
// to.Ptr("1.0.3"),
// },
// Epss: &armiotfirmwaredefense.EpssProperties{
// Score: to.Ptr[float32](0.00206),
// Percentile: to.Ptr[float32](0.3871),
// },
// Cwes: []*armiotfirmwaredefense.CweProperties{
// {
// CweID: to.Ptr("CWE-74"),
// CweName: to.Ptr("Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')"),
// Description: to.Ptr("The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component."),
// },
// },
// Kev: &armiotfirmwaredefense.KevProperties{
// KnownRansomwareCampaignUse: to.Ptr(armiotfirmwaredefense.RansomwareCampaignUseUnknown),
// DateAdded: to.Ptr(time.Date(2025, time.November, 1, 0, 0, 0, 0, time.UTC)),
// RemediationDueDate: to.Ptr(time.Date(2026, time.January, 1, 0, 0, 0, 0, time.UTC)),
// RequiredAction: to.Ptr("If at all possible, use library calls rather than external processes to recreate the desired functionality."),
// },
// },
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroupName/providers/Microsoft.IoTFirmwareDefense/workspaces/WorkspaceName/firmwares/00000000-0000-0000-0000-000000000000/cves/00000000-0000-0000-0000-000000000000"),
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Type: to.Ptr("Microsoft.IoTFirmwareDefense/workspaces/firmwares/cves"),
// SystemData: &armiotfirmwaredefense.SystemData{
// CreatedBy: to.Ptr("UserName"),
// CreatedByType: to.Ptr(armiotfirmwaredefense.CreatedByTypeUser),
// CreatedAt: to.Ptr(time.Date(2024, time.June, 13, 15, 22, 45, 940000000, time.UTC)),
// LastModifiedBy: to.Ptr("UserName"),
// LastModifiedByType: to.Ptr(armiotfirmwaredefense.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(time.Date(2024, time.June, 13, 15, 22, 45, 940000000, time.UTC)),
// },
// },
// },
// NextLink: to.Ptr("https://microsoft.com/a"),
// },
// }
}
}
// Generated from example definition: 2026-06-01-preview/Cves_ListByFirmware_MinimumSet_Gen.json
func ExampleCvesClient_NewListByFirmwarePager_cvesListByFirmwareMinimumSetGen() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotfirmwaredefense.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewCvesClient().NewListByFirmwarePager("FirmwareAnalysisRG", "default", "00000000-0000-0000-0000-000000000000", 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 = armiotfirmwaredefense.CvesClientListByFirmwareResponse{
// CveResourceListResult: armiotfirmwaredefense.CveResourceListResult{
// Value: []*armiotfirmwaredefense.CveResource{
// },
// },
// }
}
}