-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathcryptokeys_client_example_test.go
More file actions
106 lines (102 loc) · 4.91 KB
/
Copy pathcryptokeys_client_example_test.go
File metadata and controls
106 lines (102 loc) · 4.91 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
// 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/CryptoKeys_ListByFirmware_MaximumSet_Gen.json
func ExampleCryptoKeysClient_NewListByFirmwarePager_cryptoKeysListByFirmwareMaximumSetGenGeneratedByMaximumSetRule() {
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.NewCryptoKeysClient().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.CryptoKeysClientListByFirmwareResponse{
// CryptoKeyResourceListResult: armiotfirmwaredefense.CryptoKeyResourceListResult{
// Value: []*armiotfirmwaredefense.CryptoKeyResource{
// {
// Properties: &armiotfirmwaredefense.CryptoKey{
// CryptoKeyID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// KeyType: to.Ptr(armiotfirmwaredefense.CryptoKeyType("0")),
// KeyAlgorithm: to.Ptr("RSA"),
// Usage: []*string{
// to.Ptr("ssh"),
// },
// FilePaths: []*string{
// to.Ptr("path/to/key/file.pem"),
// },
// PairedKey: &armiotfirmwaredefense.PairedKey{
// Type: to.Ptr("Certificate"),
// PairedKeyID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// },
// IsShortKeySize: to.Ptr(true),
// ProvisioningState: to.Ptr(armiotfirmwaredefense.ProvisioningStateSucceeded),
// CryptoKeySize: to.Ptr[int64](2048),
// },
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ResourceGroupName/providers/Microsoft.IoTFirmwareDefense/workspaces/WorkspaceName/firmwares/00000000-0000-0000-0000-000000000000/cryptoKeys/00000000-0000-0000-0000-000000000000"),
// Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
// Type: to.Ptr("Microsoft.IoTFirmwareDefense/workspaces/firmwares/cryptoKeys"),
// 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/CryptoKeys_ListByFirmware_MinimumSet_Gen.json
func ExampleCryptoKeysClient_NewListByFirmwarePager_cryptoKeysListByFirmwareMinimumSetGen() {
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.NewCryptoKeysClient().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.CryptoKeysClientListByFirmwareResponse{
// CryptoKeyResourceListResult: armiotfirmwaredefense.CryptoKeyResourceListResult{
// Value: []*armiotfirmwaredefense.CryptoKeyResource{
// },
// },
// }
}
}