gpt4 book ai didi

Azure SDK for Go - 可以获取 KeyVault 但无法获取 KeyVault.Properties

转载 作者:行者123 更新时间:2023-12-01 22:20:49 27 4
gpt4 key购买 nike

我目前正在使用 Azure SDK for Go。一切都很顺利,直到我遇到以下问题:

keyVault, err := client.Get(context.Background(), "NAME_OF_RESOURCE_GROUP", "NAME_OF_KEY_VAULT")
当我运行这个:
log.Print(*keyVault.Name)
它显示了很好的 Key Vault 的名称。
但是,当我尝试与以下任何事情有关时: *keyVault.Properties.EnableSoftDelete我得到 - null我可以在模型上看到 Vault 属性:
type Vault struct {
autorest.Response `json:"-"`
// Properties - Properties of the vault
Properties *VaultProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The Azure Resource Manager resource ID for the key vault.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the key vault.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The resource type of the key vault.
Type *string `json:"type,omitempty"`
// Location - The supported Azure location where the key vault should be created.
Location *string `json:"location,omitempty"`
// Tags - The tags that will be assigned to the key vault.
Tags map[string]*string `json:"tags"`
}
但无论我尝试什么,它们都只是 null任何帮助都会很棒。

最佳答案

好的,所以我意识到问题所在。
如果 EnableSoftDelete 未设置或可能从未设置,则不是这样:

*keyVault.Properties.EnableSoftDelete = false
这是真的:
*keyVault.Properties.EnableSoftDelete = null
所以这是一个 Azure REST API 响应,其中软删除未启用且从未禁用:
{
"id": "/subscriptions/***/resourceGroups/rg-prd-aus-dislqmwkcq/providers/Microsoft.KeyVault/vaults/kv-prd-aus-dislqmwkcq",
"name": "kv-prd-aus-dislqmwkcq",
"type": "Microsoft.KeyVault/vaults",
"location": "australiasoutheast",
"tags": {
"example_key_vault_1": "example-kv"
},
"properties": {
"sku": {
"family": "A",
"name": "premium"
},
"tenantId": "***",
"networkAcls": {
"bypass": "AzureServices",
"defaultAction": "Deny",
"ipRules": [
{
"value": "0.0.0.0/0"
}
],
"virtualNetworkRules": []
},
"accessPolicies": [],
"enabledForDeployment": false,
"enabledForDiskEncryption": false,
"enabledForTemplateDeployment": false,
"vaultUri": "https://***.azure.net/",
"provisioningState": "Succeeded"
}
}

关于Azure SDK for Go - 可以获取 KeyVault 但无法获取 KeyVault.Properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63612509/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com