我有以下代码:
type AzStorageAccount struct {
Type string `json:"type"`
Location string `json:"location"`
Tags struct {
} `json:"tags"`
Properties struct {
PrivateLinkServiceConnections []struct {
Name string `json:"name"`
Properties struct {
PrivateLinkServiceID string `json:"privateLinkServiceId"`
GroupIds string `json:"groupIds"`
PrivateLinkServiceConnectionState struct {
Status string `json:"status"`
Description string `json:"description"`
ActionsRequired string `json:"actionsRequired"`
} `json:"privateLinkServiceConnectionState"`
} `json:"properties"`
} `json:"privateLinkServiceConnections"`
ManualPrivateLinkServiceConnections []interface{} `json:"manualPrivateLinkServiceConnections"`
Subnet struct {
ID string `json:"id"`
} `json:"subnet"`
CustomDNSConfigs []interface{} `json:"customDnsConfigs"`
} `json:"properties"`
}
但是我在将值分配给 PrivateLinkServiceConnections []struct {} 中的变量时遇到问题
起初我正在使用,但由于我需要使用 []struct 它不再起作用。
storageAccount.Location = "eastus2"
storageAccount.Type = "Microsoft.Network/privateEndpoints"
storageAccount.Properties.PrivateLinkServiceConnections.Properties.PrivateLinkServiceId = "/subscriptions"
storageAccount.Properties.PrivateLinkServiceConnections.Name = "priv-endpoint"
storageAccount.Properties.PrivateLinkServiceConnections.Properties.GroupIds = "postgresqlServer"
storageAccount.Properties.PrivateLinkServiceConnections.Properties.PrivateLinkServiceConnectionState.Status = "Approved"
storageAccount.Properties.PrivateLinkServiceConnections.Properties.PrivateLinkServiceConnectionState.Description = "Auto-approved"
storageAccount.Properties.PrivateLinkServiceConnections.Properties.PrivateLinkServiceConnectionState.ActionsRequired = "None"
storageAccount.Properties.Subnet.Id = "/subscriptions/..."
如何为下面的代码赋值?
www说
蛊毒传说
扬帆大鱼
相关分类