Skip to content

Commit a3eb442

Browse files
committed
Add missing image attributes to image data sources
1 parent 930becd commit a3eb442

File tree

4 files changed

+93
-10
lines changed

4 files changed

+93
-10
lines changed

ibm/service/power/data_source_ibm_pi_catalog_images.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func DataSourceIBMPICatalogImages() *schema.Resource {
7878
},
7979
Attr_Endianness: {
8080
Computed: true,
81-
Description: "The Endianness order.",
81+
Description: "The endianness order.",
8282
Type: schema.TypeString,
8383
},
8484
Attr_Href: {
@@ -116,6 +116,16 @@ func DataSourceIBMPICatalogImages() *schema.Resource {
116116
Description: "Operating System.",
117117
Type: schema.TypeString,
118118
},
119+
Attr_Shared: {
120+
Computed: true,
121+
Description: "Indicates whether the image is shared.",
122+
Type: schema.TypeBool,
123+
},
124+
Attr_SourceChecksum: {
125+
Computed: true,
126+
Description: "Checksum of the image.",
127+
Type: schema.TypeString,
128+
},
119129
Attr_State: {
120130
Computed: true,
121131
Description: "The state of an Operating System.",
@@ -202,6 +212,12 @@ func dataSourceIBMPICatalogImagesRead(ctx context.Context, d *schema.ResourceDat
202212
if s.OperatingSystem != "" {
203213
image[Attr_OperatingSystem] = s.OperatingSystem
204214
}
215+
if s.Shared != "" {
216+
image[Attr_Shared] = s.Shared
217+
}
218+
if s.SourceChecksum != "" {
219+
image[Attr_SourceChecksum] = s.SourceChecksum
220+
}
205221
}
206222
if i.State != nil {
207223
image[Attr_State] = *i.State

ibm/service/power/data_source_ibm_pi_image.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,29 @@ func DataSourceIBMPIImage() *schema.Resource {
3737
// Attributes
3838
Attr_Architecture: {
3939
Computed: true,
40-
Description: "The CPU architecture that the image is designed for. ",
40+
Description: "The CPU architecture that the image is designed for.",
4141
Type: schema.TypeString,
4242
},
4343
Attr_CRN: {
4444
Computed: true,
4545
Description: "The CRN of this resource.",
4646
Type: schema.TypeString,
4747
},
48+
Attr_ContainerFormat: {
49+
Computed: true,
50+
Description: "The container format.",
51+
Type: schema.TypeString,
52+
},
53+
Attr_DiskFormat: {
54+
Computed: true,
55+
Description: "The disk format.",
56+
Type: schema.TypeString,
57+
},
58+
Attr_Endianness: {
59+
Computed: true,
60+
Description: "The endianness order.",
61+
Type: schema.TypeBool,
62+
},
4863
Attr_Hypervisor: {
4964
Computed: true,
5065
Description: "Hypervision Type.",
@@ -60,6 +75,11 @@ func DataSourceIBMPIImage() *schema.Resource {
6075
Description: "The operating system that is installed with the image.",
6176
Type: schema.TypeString,
6277
},
78+
Attr_Shared: {
79+
Computed: true,
80+
Description: "Indicates whether the image is shared.",
81+
Type: schema.TypeBool,
82+
},
6383
Attr_Size: {
6484
Computed: true,
6585
Description: "The size of the image in megabytes.",
@@ -116,6 +136,7 @@ func dataSourceIBMPIImagesRead(ctx context.Context, d *schema.ResourceData, meta
116136

117137
d.SetId(*imagedata.ImageID)
118138
d.Set(Attr_Architecture, imagedata.Specifications.Architecture)
139+
d.Set(Attr_ContainerFormat, imagedata.Specifications.ContainerFormat)
119140
if imagedata.Crn != "" {
120141
d.Set(Attr_CRN, imagedata.Crn)
121142
tags, err := flex.GetGlobalTagsUsingCRN(meta, string(imagedata.Crn), "", UserTagType)
@@ -124,9 +145,12 @@ func dataSourceIBMPIImagesRead(ctx context.Context, d *schema.ResourceData, meta
124145
}
125146
d.Set(Attr_UserTags, tags)
126147
}
148+
d.Set(Attr_DiskFormat, imagedata.Specifications.DiskFormat)
149+
d.Set(Attr_Endianness, imagedata.Specifications.Endianness)
127150
d.Set(Attr_Hypervisor, imagedata.Specifications.HypervisorType)
128151
d.Set(Attr_ImageType, imagedata.Specifications.ImageType)
129152
d.Set(Attr_OperatingSystem, imagedata.Specifications.OperatingSystem)
153+
d.Set(Attr_Shared, imagedata.Specifications.Shared)
130154
d.Set(Attr_Size, imagedata.Size)
131155
d.Set(Attr_SourceChecksum, imagedata.Specifications.SourceChecksum)
132156
d.Set(Attr_State, imagedata.State)

ibm/service/power/data_source_ibm_pi_images.go

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,41 @@ func DataSourceIBMPIImages() *schema.Resource {
3737
Description: "List of all supported images.",
3838
Elem: &schema.Resource{
3939
Schema: map[string]*schema.Schema{
40+
Attr_Architecture: {
41+
Computed: true,
42+
Description: "The CPU architecture that the image is designed for.",
43+
Type: schema.TypeString,
44+
},
4045
Attr_CRN: {
4146
Computed: true,
4247
Description: "The CRN of this resource.",
4348
Type: schema.TypeString,
4449
},
50+
Attr_ContainerFormat: {
51+
Computed: true,
52+
Description: "The container format.",
53+
Type: schema.TypeString,
54+
},
55+
Attr_DiskFormat: {
56+
Computed: true,
57+
Description: "The disk format.",
58+
Type: schema.TypeString,
59+
},
60+
Attr_Endianness: {
61+
Computed: true,
62+
Description: "The endianness order.",
63+
Type: schema.TypeBool,
64+
},
4565
Attr_Href: {
4666
Computed: true,
4767
Description: "The hyper link of an image.",
4868
Type: schema.TypeString,
4969
},
70+
Attr_Hypervisor: {
71+
Computed: true,
72+
Description: "Hypervision Type.",
73+
Type: schema.TypeString,
74+
},
5075
Attr_ID: {
5176
Computed: true,
5277
Description: "The unique identifier of an image.",
@@ -62,6 +87,16 @@ func DataSourceIBMPIImages() *schema.Resource {
6287
Description: "The name of an image.",
6388
Type: schema.TypeString,
6489
},
90+
Attr_OperatingSystem: {
91+
Computed: true,
92+
Description: "The operating system that is installed with the image.",
93+
Type: schema.TypeString,
94+
},
95+
Attr_Shared: {
96+
Computed: true,
97+
Description: "Indicates whether the image is shared.",
98+
Type: schema.TypeBool,
99+
},
65100
Attr_SourceChecksum: {
66101
Computed: true,
67102
Description: "Checksum of the image.",
@@ -126,14 +161,21 @@ func flattenStockImages(list []*models.ImageReference, meta any) []map[string]an
126161
result := make([]map[string]any, 0, len(list))
127162
for _, i := range list {
128163
l := map[string]any{
129-
Attr_Href: *i.Href,
130-
Attr_ID: *i.ImageID,
131-
Attr_ImageType: i.Specifications.ImageType,
132-
Attr_Name: *i.Name,
133-
Attr_SourceChecksum: i.Specifications.SourceChecksum,
134-
Attr_State: *i.State,
135-
Attr_StoragePool: *i.StoragePool,
136-
Attr_StorageType: *i.StorageType,
164+
Attr_Architecture: i.Specifications.Architecture,
165+
Attr_ContainerFormat: i.Specifications.ContainerFormat,
166+
Attr_DiskFormat: i.Specifications.DiskFormat,
167+
Attr_Endianness: i.Specifications.Endianness,
168+
Attr_Href: *i.Href,
169+
Attr_Hypervisor: i.Specifications.HypervisorType,
170+
Attr_ID: *i.ImageID,
171+
Attr_ImageType: i.Specifications.ImageType,
172+
Attr_Name: *i.Name,
173+
Attr_OperatingSystem: i.Specifications.OperatingSystem,
174+
Attr_Shared: i.Specifications.Shared,
175+
Attr_SourceChecksum: i.Specifications.SourceChecksum,
176+
Attr_State: *i.State,
177+
Attr_StoragePool: *i.StoragePool,
178+
Attr_StorageType: *i.StorageType,
137179
}
138180
if i.Crn != "" {
139181
l[Attr_CRN] = i.Crn

ibm/service/power/ibm_pi_constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ const (
430430
Attr_ServerName = "server_name"
431431
Attr_Servers = "servers"
432432
Attr_Shareable = "shreable"
433+
Attr_Shared = "shared"
433434
Attr_SharedCoreRatio = "shared_core_ratio"
434435
Attr_SharedProcessorPool = "shared_processor_pool"
435436
Attr_SharedProcessorPoolID = "shared_processor_pool_id"

0 commit comments

Comments
 (0)