|
54 | 54 | Limits types.Object `tfsdk:"limits"` |
55 | 55 | CreatedTime types.String `tfsdk:"created_time"` |
56 | 56 | LastModifiedTime types.String `tfsdk:"last_modified_time"` |
| 57 | + ConnectivityRuleIds types.List `tfsdk:"connectivity_rule_ids"` |
57 | 58 | } |
58 | 59 |
|
59 | 60 | endpointsDataModel struct { |
@@ -275,6 +276,12 @@ func namespaceDataSourceSchema(idRequired bool) map[string]schema.Attribute { |
275 | 276 | Optional: true, |
276 | 277 | Description: "The date and time when the namespace was last modified. Will not be set if the namespace has never been modified.", |
277 | 278 | }, |
| 279 | + "connectivity_rule_ids": schema.ListAttribute{ |
| 280 | + Computed: true, |
| 281 | + Optional: true, |
| 282 | + Description: "The IDs of the connectivity rules for this namespace.", |
| 283 | + ElementType: types.StringType, |
| 284 | + }, |
278 | 285 | } |
279 | 286 | } |
280 | 287 |
|
@@ -502,5 +509,21 @@ func namespaceToNamespaceDataModel(ctx context.Context, ns *namespacev1.Namespac |
502 | 509 | } |
503 | 510 | namespaceModel.Limits = limits |
504 | 511 |
|
| 512 | + // Initialize ConnectivityRuleIds with proper type |
| 513 | + connectivityRuleIds := types.ListNull(types.StringType) |
| 514 | + if len(ns.GetSpec().GetConnectivityRuleIds()) > 0 { |
| 515 | + var connectivityRuleIdStrs []attr.Value |
| 516 | + for _, id := range ns.GetSpec().GetConnectivityRuleIds() { |
| 517 | + connectivityRuleIdStrs = append(connectivityRuleIdStrs, types.StringValue(id)) |
| 518 | + } |
| 519 | + connectivityRuleIdsList, listDiags := types.ListValue(types.StringType, connectivityRuleIdStrs) |
| 520 | + diags.Append(listDiags...) |
| 521 | + if diags.HasError() { |
| 522 | + return nil, diags |
| 523 | + } |
| 524 | + connectivityRuleIds = connectivityRuleIdsList |
| 525 | + } |
| 526 | + namespaceModel.ConnectivityRuleIds = connectivityRuleIds |
| 527 | + |
505 | 528 | return namespaceModel, nil |
506 | 529 | } |
0 commit comments