-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathbinaryhardening_client_example_test.go
More file actions
104 lines (100 loc) · 5.04 KB
/
Copy pathbinaryhardening_client_example_test.go
File metadata and controls
104 lines (100 loc) · 5.04 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
// 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/BinaryHardening_ListByFirmware_MaximumSet_Gen.json
func ExampleBinaryHardeningClient_NewListByFirmwarePager_binaryHardeningListByFirmwareMaximumSetGenGeneratedByMaximumSetRule() {
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.NewBinaryHardeningClient().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.BinaryHardeningClientListByFirmwareResponse{
// BinaryHardeningResourceListResult: armiotfirmwaredefense.BinaryHardeningResourceListResult{
// Value: []*armiotfirmwaredefense.BinaryHardeningResource{
// {
// Properties: &armiotfirmwaredefense.BinaryHardeningResult{
// BinaryHardeningID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// FilePath: to.Ptr("test/arm_stripped_mostly.elf"),
// Runpath: to.Ptr("no"),
// Rpath: to.Ptr("yes"),
// ProvisioningState: to.Ptr(armiotfirmwaredefense.ProvisioningStateSucceeded),
// SecurityHardeningFeatures: &armiotfirmwaredefense.BinaryHardeningFeatures{
// NoExecute: to.Ptr(true),
// PositionIndependentExecutable: to.Ptr(true),
// RelocationReadOnly: to.Ptr(true),
// Canary: to.Ptr(true),
// Stripped: to.Ptr(true),
// },
// ExecutableClass: to.Ptr(armiotfirmwaredefense.ExecutableClassX86),
// ExecutableArchitecture: to.Ptr("ARM"),
// },
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroupName/providers/Microsoft.IoTFirmwareDefense/workspaces/WorkspaceName/firmwares/00000000-0000-0000-0000-000000000000/binaryHardening/00000000-0000-0000-0000-000000000000"),
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Type: to.Ptr("Microsoft.IoTFirmwareDefense/workspaces/firmwares/binaryHardening"),
// 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/BinaryHardening_ListByFirmware_MinimumSet_Gen.json
func ExampleBinaryHardeningClient_NewListByFirmwarePager_binaryHardeningListByFirmwareMinimumSetGen() {
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.NewBinaryHardeningClient().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.BinaryHardeningClientListByFirmwareResponse{
// BinaryHardeningResourceListResult: armiotfirmwaredefense.BinaryHardeningResourceListResult{
// Value: []*armiotfirmwaredefense.BinaryHardeningResource{
// },
// },
// }
}
}