Skip to content

Commit

Permalink
fix(Catalog Management): Re-gen SDK
Browse files Browse the repository at this point in the history
Signed-off-by: James Dubee <jwdubee@us.ibm.com>
Signed-off-by: dubeejw <jwdubee@us.ibm.com>
  • Loading branch information
dubee committed Sep 15, 2022
1 parent 5d0b22e commit 912408f
Show file tree
Hide file tree
Showing 8 changed files with 32,339 additions and 24,844 deletions.
20,939 changes: 13,440 additions & 7,499 deletions catalogmanagementv1/catalog_management_v1.go

Large diffs are not rendered by default.

81 changes: 24 additions & 57 deletions catalogmanagementv1/catalog_management_v1_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ package catalogmanagementv1_test
import (
"encoding/json"
"fmt"
"os"

"github.com/IBM/go-sdk-core/v5/core"
"github.com/IBM/platform-services-go-sdk/catalogmanagementv1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"log"
"os"
)

//
Expand All @@ -51,6 +51,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
const externalConfigFile = "../catalog_mgmt.env"

var (
err error
catalogManagementService *catalogmanagementv1.CatalogManagementV1
config map[string]string
configLoaded bool = false
Expand All @@ -63,6 +64,8 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
objectID string
offeringInstanceID string
versionLocatorID string
serviceURL string
auditLogID string
)

var shouldSkipTest = func() {
Expand Down Expand Up @@ -93,8 +96,15 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
clusterID = config["CLUSTER_ID"]
Expect(clusterID).NotTo(BeEmpty())

serviceURL = config["URL"]
if serviceURL == "" {
Skip("Unable to load service URL configuration property, skipping tests")
}

gitAuthTokenForPublicRepo = config["GIT_TOKEN"]
Expect(gitAuthTokenForPublicRepo).NotTo(BeEmpty())

fmt.Fprintf(GinkgoWriter, "Service URL: %v\n", serviceURL)
})
})

Expand All @@ -107,7 +117,10 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {

catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{}

catalogManagementService, err := catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions)
catalogManagementService, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions)
Expect(err).To(BeNil())
Expect(catalogManagementService).ToNot(BeNil())
Expect(catalogManagementService.Service.Options.URL).To(Equal(serviceURL))

if err != nil {
panic(err)
Expand All @@ -117,6 +130,8 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {

Expect(catalogManagementService).ToNot(BeNil())

core.SetLogger(core.NewLogger(core.LevelDebug, log.New(GinkgoWriter, "", log.LstdFlags), log.New(GinkgoWriter, "", log.LstdFlags)))

bearerToken, err := catalogManagementService.Service.Options.Authenticator.(*core.IamAuthenticator).GetToken()
Expect(err).To(BeNil())
Expect(bearerToken).NotTo(BeNil())
Expand Down Expand Up @@ -330,7 +345,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
importOfferingOptions.Zipurl = core.StringPtr("https://github.com/rhm-samples/node-red-operator/blob/master/node-red-operator/bundle/0.0.2/node-red-operator.v0.0.2.clusterserviceversion.yaml")
importOfferingOptions.OfferingID = &offeringID
importOfferingOptions.TargetVersion = core.StringPtr("0.0.2")
importOfferingOptions.RepoType = core.StringPtr("git_public")
importOfferingOptions.Repotype = core.StringPtr("git_public")
importOfferingOptions.XAuthToken = &gitAuthTokenForPublicRepo

offering, response, err := catalogManagementService.ImportOffering(importOfferingOptions)
Expand Down Expand Up @@ -426,6 +441,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
getOfferingAuditOptions := catalogManagementService.NewGetOfferingAuditOptions(
catalogID,
offeringID,
auditLogID,
)

auditLog, response, err := catalogManagementService.GetOfferingAudit(getOfferingAuditOptions)
Expand Down Expand Up @@ -489,7 +505,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
fmt.Println("\nGetCatalogAccountAudit() result:")
// begin-get_catalog_account_audit

getCatalogAccountAuditOptions := catalogManagementService.NewGetCatalogAccountAuditOptions()
getCatalogAccountAuditOptions := catalogManagementService.NewGetCatalogAccountAuditOptions(auditLogID)

auditLog, response, err := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptions)
if err != nil {
Expand Down Expand Up @@ -531,6 +547,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {

getCatalogAuditOptions := catalogManagementService.NewGetCatalogAuditOptions(
catalogID,
auditLogID,
)

auditLog, response, err := catalogManagementService.GetCatalogAudit(getCatalogAuditOptions)
Expand Down Expand Up @@ -578,7 +595,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
importOfferingVersionOptions.TargetKinds = []string{"roks"}
importOfferingVersionOptions.Zipurl = core.StringPtr("https://github.com/rhm-samples/node-red-operator/blob/master/node-red-operator/bundle/0.0.2/node-red-operator.v0.0.2.clusterserviceversion.yaml")
importOfferingVersionOptions.TargetVersion = core.StringPtr("0.0.3")
importOfferingVersionOptions.RepoType = core.StringPtr("git_public")
importOfferingVersionOptions.Repotype = core.StringPtr("git_public")

offering, response, err := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptions)
if err != nil {
Expand All @@ -594,57 +611,6 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
Expect(offering).ToNot(BeNil())
})

It(`ReplaceOfferingIcon request example`, func() {
Skip("Skipped by desing.")
fmt.Println("\nReplaceOfferingIcon() result:")
// begin-replace_offering_icon

replaceOfferingIconOptions := catalogManagementService.NewReplaceOfferingIconOptions(
catalogID,
offeringID,
"offering_icon.png",
)

offering, response, err := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(offering, "", " ")
fmt.Println(string(b))

// end-replace_offering_icon

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(offering).ToNot(BeNil())
})

It(`UpdateOfferingIBM request example`, func() {
Skip("Skipped by desing.")
fmt.Println("\nUpdateOfferingIBM() result:")
// begin-update_offering_ibm

updateOfferingIBMOptions := catalogManagementService.NewUpdateOfferingIBMOptions(
catalogID,
offeringID,
"allow_request",
"true",
)

approvalResult, response, err := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(approvalResult, "", " ")
fmt.Println(string(b))

// end-update_offering_ibm

Expect(err).To(BeNil())
Expect(response.StatusCode).To(Equal(200))
Expect(approvalResult).ToNot(BeNil())
})

It(`GetOfferingUpdates request example`, func() {
Skip("Skipped by desing.")
fmt.Println("\nGetOfferingUpdates() result:")
Expand Down Expand Up @@ -1282,6 +1248,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() {
getObjectAuditOptions := catalogManagementService.NewGetObjectAuditOptions(
catalogID,
objectID,
auditLogID,
)

auditLog, response, err := catalogManagementService.GetObjectAudit(getObjectAuditOptions)
Expand Down
Loading

0 comments on commit 912408f

Please sign in to comment.