Skip to content

Commit b961a7e

Browse files
authored
[D][R] Add creation date attribute to shared processor pool data source and resource (IBM-Cloud#6446)
* Update dependencies and fix errors from dependencies * Add creation date attribute to shared processor pool data source and resource * Fix creation date set
1 parent 34cbf4e commit b961a7e

File tree

5 files changed

+23
-3
lines changed

5 files changed

+23
-3
lines changed

ibm/service/power/data_source_ibm_pi_shared_processor_pool.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ func DataSourceIBMPISharedProcessorPool() *schema.Resource {
4444
Description: "The available cores in the shared processor pool.",
4545
Type: schema.TypeFloat,
4646
},
47+
Attr_CreationDate: {
48+
Computed: true,
49+
Description: "Date of shared processor pool creation.",
50+
Type: schema.TypeString,
51+
},
4752
Attr_CRN: {
4853
Computed: true,
4954
Description: "The CRN of this resource.",
@@ -176,6 +181,7 @@ func dataSourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resou
176181
d.Set(Attr_UserTags, tags)
177182
}
178183
}
184+
d.Set(Attr_CreationDate, response.SharedProcessorPool.CreationDate.String())
179185
d.Set(Attr_DedicatedHostID, response.SharedProcessorPool.DedicatedHostID)
180186
d.Set(Attr_HostID, response.SharedProcessorPool.HostID)
181187
d.Set(Attr_Name, response.SharedProcessorPool.Name)

ibm/service/power/data_source_ibm_pi_shared_processor_pools.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ func DataSourceIBMPISharedProcessorPools() *schema.Resource {
4444
Description: "The available cores in the shared processor pool.",
4545
Type: schema.TypeInt,
4646
},
47+
Attr_CreationDate: {
48+
Computed: true,
49+
Description: "Date of shared processor pool creation.",
50+
Type: schema.TypeString,
51+
},
4752
Attr_CRN: {
4853
Computed: true,
4954
Description: "The CRN of this resource.",
@@ -99,7 +104,7 @@ func DataSourceIBMPISharedProcessorPools() *schema.Resource {
99104
}
100105
}
101106

102-
func dataSourceIBMPISharedProcessorPoolsRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
107+
func dataSourceIBMPISharedProcessorPoolsRead(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
103108
sess, err := meta.(conns.ClientSession).IBMPISession()
104109
if err != nil {
105110
return diag.FromErr(err)
@@ -113,11 +118,12 @@ func dataSourceIBMPISharedProcessorPoolsRead(ctx context.Context, d *schema.Reso
113118
return diag.Errorf("error fetching shared processor pools: %v", err)
114119
}
115120

116-
result := make([]map[string]interface{}, 0, len(pools.SharedProcessorPools))
121+
result := make([]map[string]any, 0, len(pools.SharedProcessorPools))
117122
for _, pool := range pools.SharedProcessorPools {
118-
key := map[string]interface{}{
123+
key := map[string]any{
119124
Attr_AllocatedCores: *pool.AllocatedCores,
120125
Attr_AvailableCores: *pool.AvailableCores,
126+
Attr_CreationDate: pool.CreationDate.String(),
121127
Attr_DedicatedHostID: pool.DedicatedHostID,
122128
Attr_HostID: pool.HostID,
123129
Attr_Name: *pool.Name,

ibm/service/power/resource_ibm_pi_shared_processor_pool.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func ResourceIBMPISharedProcessorPool() *schema.Resource {
103103
Description: "The available cores in the shared processor pool.",
104104
Type: schema.TypeInt,
105105
},
106+
Attr_CreationDate: {
107+
Computed: true,
108+
Description: "Date of shared processor pool creation.",
109+
Type: schema.TypeString,
110+
},
106111
Attr_CRN: {
107112
Computed: true,
108113
Description: "The CRN of this resource.",
@@ -338,6 +343,7 @@ func resourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resourc
338343
d.Set(Arg_SharedProcessorPoolPlacementGroups, pgIDs)
339344
}
340345
}
346+
d.Set(Attr_CreationDate, response.SharedProcessorPool.CreationDate.String())
341347
d.Set(Attr_DedicatedHostID, response.SharedProcessorPool.DedicatedHostID)
342348
d.Set(Attr_HostID, response.SharedProcessorPool.HostID)
343349
d.Set(Attr_Status, response.SharedProcessorPool.Status)

website/docs/d/pi_shared_processor_pool.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ In addition to all argument reference list, you can access the following attribu
4848

4949
- `allocated_cores` - (Float) The allocated cores in the shared processor pool.
5050
- `available_cores` - (Integer) The available cores in the shared processor pool.
51+
- `creation_date` - (String) Date of shared processor pool creation.
5152
- `crn` - (String) The CRN of this resource.
5253
- `dedicated_host_id` - (String) The dedicated host ID where the shared processor pool resides.
5354
- `host_id` - (Integer) The host ID where the shared processor pool resides.

website/docs/d/pi_shared_processor_pools.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ In addition to all argument reference list, you can access the following attribu
4949
Nested scheme for `shared_processor_pools`:
5050
- `allocated_cores` - (Float) The allocated cores in the shared processor pool.
5151
- `available_cores` - (Integer) The available cores in the shared processor pool.
52+
- `creation_date` - (String) Date of shared processor pool creation.
5253
- `crn` - (String) The CRN of this resource.
5354
- `dedicated_host_id` - (String) The dedicated host ID where the shared processor pool resides.
5455
- `host_id` - (Integer) The host ID where the shared processor pool resides.

0 commit comments

Comments
 (0)