Skip to content

Commit 601a399

Browse files
feat(partner center sell): less restriction on catalog product media item (#6243)
* feat(partner center sell): less restriction on catalog product media items Signed-off-by: Peter Harasztia <[email protected]> * feat(partner center sell): updated platform-services-go-sdk to containe our changes Signed-off-by: Peter Harasztia <[email protected]> --------- Signed-off-by: Peter Harasztia <[email protected]>
1 parent 7e33ef6 commit 601a399

File tree

6 files changed

+92
-32
lines changed

6 files changed

+92
-32
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
github.com/IBM/logs-router-go-sdk v1.0.7
2929
github.com/IBM/mqcloud-go-sdk v0.2.0
3030
github.com/IBM/networking-go-sdk v0.51.4
31-
github.com/IBM/platform-services-go-sdk v0.78.0
31+
github.com/IBM/platform-services-go-sdk v0.81.1
3232
github.com/IBM/project-go-sdk v0.3.5
3333
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
3434
github.com/IBM/sarama v1.45.0
@@ -101,7 +101,7 @@ require (
101101
github.com/go-logr/logr v1.4.2 // indirect
102102
github.com/go-logr/stdr v1.2.2 // indirect
103103
github.com/go-openapi/analysis v0.21.5 // indirect
104-
github.com/go-openapi/errors v0.22.0 // indirect
104+
github.com/go-openapi/errors v0.22.1 // indirect
105105
github.com/go-openapi/jsonpointer v0.21.0 // indirect
106106
github.com/go-openapi/jsonreference v0.21.0 // indirect
107107
github.com/go-openapi/loads v0.21.3 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ github.com/IBM/mqcloud-go-sdk v0.2.0 h1:QOWk8ZGk0QfIL0MOGTKzNdM3Qe0Hk+ifAFtNSFQo
149149
github.com/IBM/mqcloud-go-sdk v0.2.0/go.mod h1:VZQKMtqmcdXKhmLhLiPuS/UHMs/5yo2tA/nD83cQt9E=
150150
github.com/IBM/networking-go-sdk v0.51.4 h1:rkbR+gUkksLKjNYL5YEWEAMv3qddR0mUkxObDMa4l/s=
151151
github.com/IBM/networking-go-sdk v0.51.4/go.mod h1:gjCFEp+UVP7FUlcq2C1RaoZAXFcD39CQdlUk7uVKko4=
152-
github.com/IBM/platform-services-go-sdk v0.78.0 h1:OqfO8Qd4HQJcpgP/CLnjqFPgXtXLPbPxXlRzX4SQUH0=
153-
github.com/IBM/platform-services-go-sdk v0.78.0/go.mod h1:sX7rPXMNqmAt6wQyjnF+oISRFwz6I6XNX9My/mzLqp4=
152+
github.com/IBM/platform-services-go-sdk v0.81.1 h1:Ch9wUIigyA3HzW7MQnA1WTHAw+QA6W4bSP3ThgzDpx0=
153+
github.com/IBM/platform-services-go-sdk v0.81.1/go.mod h1:XOowH+JnIih3FA7uilLVM/9VH7XgCmJ4T/i6eZi7gkw=
154154
github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM=
155155
github.com/IBM/project-go-sdk v0.3.5/go.mod h1:FOJM9ihQV3EEAY6YigcWiTNfVCThtdY8bLC/nhQHFvo=
156156
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 h1:NPUhkoOCRuv3OFWt19PmwjXGGTKlvmbuPg9fUrBUNe4=
@@ -417,8 +417,8 @@ github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpX
417417
github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=
418418
github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk=
419419
github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho=
420-
github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w=
421-
github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE=
420+
github.com/go-openapi/errors v0.22.1 h1:kslMRRnK7NCb/CvR1q1VWuEQCEIsBGn5GgKD9e+HYhU=
421+
github.com/go-openapi/errors v0.22.1/go.mod h1:+n/5UdIqdVnLIJ6Q9Se8HNGUXYaY6CN8ImWzfi/Gzp0=
422422
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0=
423423
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
424424
github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=

ibm/service/partnercentersell/resource_ibm_onboarding_catalog_plan.go

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
/*
5-
* IBM OpenAPI Terraform Generator Version: 3.103.0-e8b84313-20250402-201816
5+
* IBM OpenAPI Terraform Generator Version: 3.104.0-b4a47c49-20250418-184351
66
*/
77

88
package partnercentersell
@@ -206,7 +206,7 @@ func ResourceIbmOnboardingCatalogPlan() *schema.Resource {
206206
Schema: map[string]*schema.Schema{
207207
"caption": &schema.Schema{
208208
Type: schema.TypeString,
209-
Required: true,
209+
Optional: true,
210210
Description: "Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.",
211211
},
212212
"thumbnail": &schema.Schema{
@@ -216,12 +216,12 @@ func ResourceIbmOnboardingCatalogPlan() *schema.Resource {
216216
},
217217
"type": &schema.Schema{
218218
Type: schema.TypeString,
219-
Required: true,
219+
Optional: true,
220220
Description: "The type of the media.",
221221
},
222222
"url": &schema.Schema{
223223
Type: schema.TypeString,
224-
Required: true,
224+
Optional: true,
225225
Description: "The URL that links to the media that shows off the product.",
226226
},
227227
},
@@ -1014,12 +1014,18 @@ func ResourceIbmOnboardingCatalogPlanMapToCatalogHighlightItem(modelMap map[stri
10141014

10151015
func ResourceIbmOnboardingCatalogPlanMapToCatalogProductMediaItem(modelMap map[string]interface{}) (*partnercentersellv1.CatalogProductMediaItem, error) {
10161016
model := &partnercentersellv1.CatalogProductMediaItem{}
1017-
model.Caption = core.StringPtr(modelMap["caption"].(string))
1017+
if modelMap["caption"] != nil && modelMap["caption"].(string) != "" {
1018+
model.Caption = core.StringPtr(modelMap["caption"].(string))
1019+
}
10181020
if modelMap["thumbnail"] != nil && modelMap["thumbnail"].(string) != "" {
10191021
model.Thumbnail = core.StringPtr(modelMap["thumbnail"].(string))
10201022
}
1021-
model.Type = core.StringPtr(modelMap["type"].(string))
1022-
model.URL = core.StringPtr(modelMap["url"].(string))
1023+
if modelMap["type"] != nil && modelMap["type"].(string) != "" {
1024+
model.Type = core.StringPtr(modelMap["type"].(string))
1025+
}
1026+
if modelMap["url"] != nil && modelMap["url"].(string) != "" {
1027+
model.URL = core.StringPtr(modelMap["url"].(string))
1028+
}
10231029
return model, nil
10241030
}
10251031

@@ -1306,12 +1312,18 @@ func ResourceIbmOnboardingCatalogPlanCatalogHighlightItemToMap(model *partnercen
13061312

13071313
func ResourceIbmOnboardingCatalogPlanCatalogProductMediaItemToMap(model *partnercentersellv1.CatalogProductMediaItem) (map[string]interface{}, error) {
13081314
modelMap := make(map[string]interface{})
1309-
modelMap["caption"] = *model.Caption
1315+
if model.Caption != nil {
1316+
modelMap["caption"] = *model.Caption
1317+
}
13101318
if model.Thumbnail != nil {
13111319
modelMap["thumbnail"] = *model.Thumbnail
13121320
}
1313-
modelMap["type"] = *model.Type
1314-
modelMap["url"] = *model.URL
1321+
if model.Type != nil {
1322+
modelMap["type"] = *model.Type
1323+
}
1324+
if model.URL != nil {
1325+
modelMap["url"] = *model.URL
1326+
}
13151327
return modelMap, nil
13161328
}
13171329

@@ -1798,12 +1810,30 @@ func ResourceIbmOnboardingCatalogPlanGlobalCatalogMetadataUINavigationItemAsPatc
17981810
func ResourceIbmOnboardingCatalogPlanCatalogProductMediaItemAsPatch(patch map[string]interface{}, d *schema.ResourceData, rootPath string) {
17991811
var path string
18001812

1813+
path = rootPath + ".caption"
1814+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
1815+
patch["caption"] = nil
1816+
} else if !exists {
1817+
delete(patch, "caption")
1818+
}
18011819
path = rootPath + ".thumbnail"
18021820
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
18031821
patch["thumbnail"] = nil
18041822
} else if !exists {
18051823
delete(patch, "thumbnail")
18061824
}
1825+
path = rootPath + ".type"
1826+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
1827+
patch["type"] = nil
1828+
} else if !exists {
1829+
delete(patch, "type")
1830+
}
1831+
path = rootPath + ".url"
1832+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
1833+
patch["url"] = nil
1834+
} else if !exists {
1835+
delete(patch, "url")
1836+
}
18071837
}
18081838

18091839
func ResourceIbmOnboardingCatalogPlanCatalogHighlightItemAsPatch(patch map[string]interface{}, d *schema.ResourceData, rootPath string) {

ibm/service/partnercentersell/resource_ibm_onboarding_catalog_product.go

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the Mozilla Public License v2.0
33

44
/*
5-
* IBM OpenAPI Terraform Generator Version: 3.103.0-e8b84313-20250402-201816
5+
* IBM OpenAPI Terraform Generator Version: 3.104.0-b4a47c49-20250418-184351
66
*/
77

88
package partnercentersell
@@ -208,7 +208,7 @@ func ResourceIbmOnboardingCatalogProduct() *schema.Resource {
208208
Schema: map[string]*schema.Schema{
209209
"caption": &schema.Schema{
210210
Type: schema.TypeString,
211-
Required: true,
211+
Optional: true,
212212
Description: "Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.",
213213
},
214214
"thumbnail": &schema.Schema{
@@ -218,12 +218,12 @@ func ResourceIbmOnboardingCatalogProduct() *schema.Resource {
218218
},
219219
"type": &schema.Schema{
220220
Type: schema.TypeString,
221-
Required: true,
221+
Optional: true,
222222
Description: "The type of the media.",
223223
},
224224
"url": &schema.Schema{
225225
Type: schema.TypeString,
226-
Required: true,
226+
Optional: true,
227227
Description: "The URL that links to the media that shows off the product.",
228228
},
229229
},
@@ -1731,12 +1731,18 @@ func ResourceIbmOnboardingCatalogProductMapToCatalogHighlightItem(modelMap map[s
17311731

17321732
func ResourceIbmOnboardingCatalogProductMapToCatalogProductMediaItem(modelMap map[string]interface{}) (*partnercentersellv1.CatalogProductMediaItem, error) {
17331733
model := &partnercentersellv1.CatalogProductMediaItem{}
1734-
model.Caption = core.StringPtr(modelMap["caption"].(string))
1734+
if modelMap["caption"] != nil && modelMap["caption"].(string) != "" {
1735+
model.Caption = core.StringPtr(modelMap["caption"].(string))
1736+
}
17351737
if modelMap["thumbnail"] != nil && modelMap["thumbnail"].(string) != "" {
17361738
model.Thumbnail = core.StringPtr(modelMap["thumbnail"].(string))
17371739
}
1738-
model.Type = core.StringPtr(modelMap["type"].(string))
1739-
model.URL = core.StringPtr(modelMap["url"].(string))
1740+
if modelMap["type"] != nil && modelMap["type"].(string) != "" {
1741+
model.Type = core.StringPtr(modelMap["type"].(string))
1742+
}
1743+
if modelMap["url"] != nil && modelMap["url"].(string) != "" {
1744+
model.URL = core.StringPtr(modelMap["url"].(string))
1745+
}
17401746
return model, nil
17411747
}
17421748

@@ -2379,12 +2385,18 @@ func ResourceIbmOnboardingCatalogProductCatalogHighlightItemToMap(model *partner
23792385

23802386
func ResourceIbmOnboardingCatalogProductCatalogProductMediaItemToMap(model *partnercentersellv1.CatalogProductMediaItem) (map[string]interface{}, error) {
23812387
modelMap := make(map[string]interface{})
2382-
modelMap["caption"] = *model.Caption
2388+
if model.Caption != nil {
2389+
modelMap["caption"] = *model.Caption
2390+
}
23832391
if model.Thumbnail != nil {
23842392
modelMap["thumbnail"] = *model.Thumbnail
23852393
}
2386-
modelMap["type"] = *model.Type
2387-
modelMap["url"] = *model.URL
2394+
if model.Type != nil {
2395+
modelMap["type"] = *model.Type
2396+
}
2397+
if model.URL != nil {
2398+
modelMap["url"] = *model.URL
2399+
}
23882400
return modelMap, nil
23892401
}
23902402

@@ -3671,12 +3683,30 @@ func ResourceIbmOnboardingCatalogProductGlobalCatalogMetadataUINavigationItemAsP
36713683
func ResourceIbmOnboardingCatalogProductCatalogProductMediaItemAsPatch(patch map[string]interface{}, d *schema.ResourceData, rootPath string) {
36723684
var path string
36733685

3686+
path = rootPath + ".caption"
3687+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
3688+
patch["caption"] = nil
3689+
} else if !exists {
3690+
delete(patch, "caption")
3691+
}
36743692
path = rootPath + ".thumbnail"
36753693
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
36763694
patch["thumbnail"] = nil
36773695
} else if !exists {
36783696
delete(patch, "thumbnail")
36793697
}
3698+
path = rootPath + ".type"
3699+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
3700+
patch["type"] = nil
3701+
} else if !exists {
3702+
delete(patch, "type")
3703+
}
3704+
path = rootPath + ".url"
3705+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
3706+
patch["url"] = nil
3707+
} else if !exists {
3708+
delete(patch, "url")
3709+
}
36803710
}
36813711

36823712
func ResourceIbmOnboardingCatalogProductCatalogHighlightItemAsPatch(patch map[string]interface{}, d *schema.ResourceData, rootPath string) {

website/docs/r/onboarding_catalog_plan.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ Nested schema for **metadata**:
155155
* `media` - (Optional, List) The list of supporting media for this product.
156156
* Constraints: The maximum length is `100` items. The minimum length is `0` items.
157157
Nested schema for **media**:
158-
* `caption` - (Required, String) Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.
158+
* `caption` - (Optional, String) Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.
159159
* Constraints: The maximum length is `2000` characters. The minimum length is `0` characters. The value must match regular expression `/^[ -~\\s]*$/`.
160160
* `thumbnail` - (Optional, String) The reduced-size version of your images and videos.
161161
* Constraints: The maximum length is `2083` characters. The minimum length is `0` characters.
162-
* `type` - (Required, String) The type of the media.
162+
* `type` - (Optional, String) The type of the media.
163163
* Constraints: Allowable values are: `image`, `youtube`, `video_mp_4`, `video_webm`.
164-
* `url` - (Required, String) The URL that links to the media that shows off the product.
164+
* `url` - (Optional, String) The URL that links to the media that shows off the product.
165165
* Constraints: The maximum length is `2083` characters. The minimum length is `0` characters.
166166
* `navigation_items` - (Optional, List) List of custom navigation panel.
167167
* Constraints: The maximum length is `100` items. The minimum length is `0` items.

website/docs/r/onboarding_catalog_product.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ Nested schema for **metadata**:
511511
* `media` - (Optional, List) The list of supporting media for this product.
512512
* Constraints: The maximum length is `100` items. The minimum length is `0` items.
513513
Nested schema for **media**:
514-
* `caption` - (Required, String) Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.
514+
* `caption` - (Optional, String) Provide a descriptive caption that indicates what the media illustrates. This caption is displayed in the catalog.
515515
* Constraints: The maximum length is `2000` characters. The minimum length is `0` characters. The value must match regular expression `/^[ -~\\s]*$/`.
516516
* `thumbnail` - (Optional, String) The reduced-size version of your images and videos.
517517
* Constraints: The maximum length is `2083` characters. The minimum length is `0` characters.
518-
* `type` - (Required, String) The type of the media.
518+
* `type` - (Optional, String) The type of the media.
519519
* Constraints: Allowable values are: `image`, `youtube`, `video_mp_4`, `video_webm`.
520-
* `url` - (Required, String) The URL that links to the media that shows off the product.
520+
* `url` - (Optional, String) The URL that links to the media that shows off the product.
521521
* Constraints: The maximum length is `2083` characters. The minimum length is `0` characters.
522522
* `navigation_items` - (Optional, List) List of custom navigation panel.
523523
* Constraints: The maximum length is `100` items. The minimum length is `0` items.

0 commit comments

Comments
 (0)